0
votes

I am working on crossbrowsertesting platform in Android Chrome and facing a challenge in which I need to click on a link that opens up in new tab. I need to switch to that new tab and get its URL. Problem is I am unable to switch to newly opened tab and get its URL.          

Method used - When using driver.switchTo().window(child_window) I am getting below error -

org.openqa.selenium.InvalidArgumentException: invalid argument: 'name' must be a string.

But the same is working fine in Windows based chrome (not Android chrome browser).

Platform Information :

crossbrowsertesting
"browserName", "Chrome"
"deviceName", "Galaxy S9"
"platformVersion", "9.0"
"platformName", "Android"
"deviceOrientation", "portrait"

3

3 Answers

0
votes

Could you provide the details of Appium/Selenium being used for testing? I found this very similar bug here: https://github.com/appium/appium/issues/13106 Please check you version is above 1.15, to confirm the fix is present in the code.

0
votes

It looks like there is a bug in chromedriver itself. W3C protocol requires the call to POST /window to have handle parameter set, but chromedriver still wants name as in JSONWP. Specs is here

It has been tested on Appium Beta version v1.14.0-beta.2 and it worked successfully on Android. Please update your appium library with this version atleast or higher to this version.

0
votes

I found the solution:

My project involved both web and native view so below is what I did

1- used chromeDriver with compatible Android emulator version

2- Switch to proper view

3- used driver.switchTo().window()

Thanks everyone for answers.