【发布时间】:2017-09-18 14:31:26
【问题描述】:
我正在使用 appium selenium 进行自动化测试。谁能帮我找到移动驱动程序的当前网址。尝试使用 driver.getCurrentUrl() 。它不工作
【问题讨论】:
标签: appium
我正在使用 appium selenium 进行自动化测试。谁能帮我找到移动驱动程序的当前网址。尝试使用 driver.getCurrentUrl() 。它不工作
【问题讨论】:
标签: appium
You need to check the context of the app :
If context is native app , you cant get url of any screen.
If App context is having WEBVIEW you will get URL
How to check context :
Set<String> contextNames = driver.getContextHandles();
for (String contextName : contextNames) {
System.out.println(contextNames);
}
You can switch to WEBVIEW using following code :
if (contextName.contains("WEBVIEW")) {
driver.context("WEBVIEW");
driver.getCurrentUrl()
}
【讨论】: