create account

Selenium Managing Multiple Tabs by python-dev

View this thread on: hive.blogpeakd.comecency.com
· @python-dev ·
$0.45
Selenium Managing Multiple Tabs
~~~
WebDriver driver = new FirefoxDriver(); 
driver.manage().window().maximize(); 
driver.get("URL");
 
String newWindow = driver.getWindowHandle();
 
driver.findElement(By.cssSelector(“body”)).sendKeys(Keys.CONTROL+”t”);
driver.get("Second URL");
 
//Perform whatever actions you want done on the secondary tab, let’s pretend we’re logging in somewhere
 
driver.findElementById(“ID”).sendKeys(“username”);
driver.findElementById(“ID”).sendKeys(“password”);
driver.findElementById(“submit”).click();
 
driver.switchTo().window(mainWindow);
 
//Perform whatever actions you want done on the main tab, we’ll click a button
driver.findElementById(“button”).click();
 
# Close current tab
driver.findElement(By.cssSelector(“body”)).sendKeys(Keys.CONTROL + 'w');
 
driver.close();
~~~
👍  , , , ,
properties (23)
authorpython-dev
permlinkselenium-managing-multiple-tabs
categorypython-dev
json_metadata{"tags":["python-dev"],"app":"steemit/0.2","format":"markdown"}
created2020-03-13 12:39:57
last_update2020-03-13 12:39:57
depth0
children1
last_payout2020-03-20 12:39:57
cashout_time1969-12-31 23:59:59
total_payout_value0.426 HBD
curator_payout_value0.026 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length779
author_reputation5,457,648,648,750
root_title"Selenium Managing Multiple Tabs"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id96,322,169
net_rshares4,294,102,428,330
author_curate_reward""
vote details (5)
@xiguang ·
$0.93
this is a good instruct ion, so it can be used to switch and automate different web pages
👍  ,
properties (23)
authorxiguang
permlinkq7bajo
categorypython-dev
json_metadata{"app":"steemit/0.2"}
created2020-03-17 00:26:09
last_update2020-03-17 00:26:09
depth1
children0
last_payout2020-03-24 00:26:09
cashout_time1969-12-31 23:59:59
total_payout_value0.467 HBD
curator_payout_value0.467 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length89
author_reputation17,083,626,025,549
root_title"Selenium Managing Multiple Tabs"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd0
post_id96,420,947
net_rshares3,899,102,781,864
author_curate_reward""
vote details (2)