sclevine / agouti

A WebDriver client and acceptance testing library for Go
MIT License
821 stars 102 forks source link

Unable to switch tabs #130

Open tite54296 opened 7 years ago

tite54296 commented 7 years ago

This is a replica of bug #119 since the issue was closes before I could answer to @sclevine. "Is it possible to switch between browser tabs? I tried using SwitchWindow and does not seem to work. I also used WindowCount to validate that the new tab is being recognized as a window but does not seem like it since it is returning 1 instead of 2 which is the number of tabs at the time." I am using the WindowCount but it is returning only one window even though two tabs are opened.

sclevine commented 7 years ago

As asked in #119, what webdriver and browser are you using with Agouti?

tite54296 commented 7 years ago

I am using chromedriver and chrome.

sclevine commented 7 years ago

Thanks, do you observe the same behavior with other webdrivers (ex. Chrome via Selenium, or Firefox via Selenium)?

tite54296 commented 7 years ago

I would have to check. Let me check it tomorrow and come back to.you.

tite54296 commented 7 years ago

Hi @sclevine this is happening with all of the drivers. This is the scenario: I am currently testing an electron app using the agouti webdriver (so far, so good). For this app I need to register to a website first, so I instantiate a driver for the electron app and another for the webpage. Now, the issue shows up when i click a button in my electron app that opens a browser tab, I thought that since the tab is opened within the same browser I am using with agouti It should detect the new tab even though it was opened from the electron app.

sclevine commented 7 years ago

To clarify, you've only observed this behavior when using two webdrivers simultaneously, one with electron, and one with a real browser?

Agouti is just a wrapper for the API endpoints provided by the webdrivers. If this scenario isn't supported by the webdrivers, there unfortunately isn't much we can do in Agouti to make it work.

As a workaround, could you grab the new browser tab link instead of clicking the button, and then open that link using a new webdriver instance? That should give both webdrivers control over their respective pages.

tite54296 commented 7 years ago

I'll try that. Thanks :)