Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
deepender
Posts : 3
Join date : 2014-09-03

Multiple tabs opening using single browser  Empty Multiple tabs opening using single browser

Fri Sep 05, 2014 9:06 pm
Hi
How can we open multiple tabs and put the url in all the tabs invoked in webdriver selenium. Please Help
avatar
Paps_engineer
Active particpant
Active particpant
Posts : 10
Join date : 2014-07-24

Multiple tabs opening using single browser  Empty Re: Multiple tabs opening using single browser

Fri Oct 10, 2014 5:19 pm
First step give the corresponding url
use this command
String parentWindow = driver.getWindowHandle();
Set handles =  driver.getWindowHandles();
   for(String windowHandle  : handles)
       {
       if(!windowHandle.equals(parentWindow))
          {
          driver.switchTo().window(windowHandle);
        
         driver.close(); //closing child window
         driver.switchTo().window(parentWindow); //cntrl to parent window
          }
       }

Thanks,
Papaiadasan.S,
Automation COE,
Indium Software India Limited.
(indiumsoft.com/core-qa-offerings/test-automation)

Test Automation
avatar
nabhanya.varma
Active particpant
Active particpant
Posts : 13
Join date : 2014-03-02

Multiple tabs opening using single browser  Empty Re: Multiple tabs opening using single browser

Tue Dec 16, 2014 12:15 am
Using selenium webdriver, we can do it simply by switching to the new window. 
Syntax: driver.switchTo().window(newWindowHandle);


But you should be effectively selecting the window that you want to work or Else it will throw element not found exception.


You can look into the below URL which has mentioned examples with simple tests with verifications and resuable methods.
Working with windows
http://seleniumeasy.com/tags/windows
Sponsored content

Multiple tabs opening using single browser  Empty Re: Multiple tabs opening using single browser

Back to top
Permissions in this forum:
You cannot reply to topics in this forum