I need to open multiple tabs within a single browser and i need switch over all the tabs.
Give me your suggestions. Thanks in advance.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’m not so strong in capybara. so, i’m giving solution to switch over between tabs using selenium.
For a instance you clicks a button in a web page and it will open a new page.
The new page may open in a
new tab in the same browser windoworin a new browser window. That is not controlled by selenium. It will control by the browser which you using.For a instance take firefox, goto
tools->ptions-> tabs-> open new windows in a new tab insteadcheck the option. For example, if you clicks a button it will opens a page only in the new tab of a same browser window. For a sake if you unchecked mean it will open a page in the new browser window. Likewise every browser has its own settings.Try this code:
In above Keys.NUMPAD2 refers that you are gonna move to the second tab in the session.
You can move to Third, Fourth, etc… by giving NUMPAD3, NUMPAD4, etc… respectively. Here i am using windows OS, if you are in some other OS use their shortcuts.
I hope this will help you.