'Selenium Android web test 'Save Card?' pop-up blocking test clicks
Hey I am having an issue with Selenium web tests with the Chrome mobile browser running on an Android device through Browserstack.
When I enter card details, the'Save Card?' pop-up appears and prevents test clicks on web elements that it covers:
Ive have tried a few solutions such as passing chrome arguments through to Browserstack but they seem to do nothing to stop this pop-up.
I've also tried to use context switching:
driver.context("NATIVE_APP");
driver.findElement(AppiumBy.xpath(".//android.widget.Button[@text='SAVE']")).click();
However this only works when specifying an 'AndroidDriver' but I am using 'RemoteWebDriver'.
My WebDriver sample code:
protected WebDriver driver;
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("build", "Samsung Galaxy S21 - " + method.getName());
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("deviceName", "Samsung Galaxy S21");
capabilities.setCapability("browser", "Chrome");
capabilities.setCapability("real_mobile", "true");
capabilities.setCapability("browserstack.appium_version", "1.22.0");
capabilities.setCapability("browserstack.local", "true");
capabilities.setCapability("browserstack.networkLogs", "true");
capabilities.setCapability("autoGrantPermissions", "true");
capabilities.setCapability("disable-popup-blocking", "true");
capabilities.setCapability("autoDismissAlerts", true);
capabilities.setCapability("unicodeKeyboard", true);
capabilities.setCapability("resetKeyboard", true);
driver = new RemoteWebDriver(new URL(Browserstack_URL), capabilities);
Is there any way for me to close this pop-up or stop it appearing altogether while using RemoteWebDriver?
Solution 1:[1]
This error message...
AttributeError: 'dict' object has no attribute 'send_keys'
...was a known issue with Selenium
As @AutomatedTester suggested there are two pottential solutions:
- Upgrading to the latest opera/chrome will make this work.
- Setting
w3c:trueingoog:chromeOptionswill make things work properly.
Example chrome setting:
options = webdriver.ChromeOptions()
options.w3c = True
Solution 2:[2]
The solution to the problem is simple, all you have to do is download the old version of Selenium:
pip install selenium==3.141.0
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | undetected Selenium |
| Solution 2 | the Tin Man |

