【问题标题】:How to find current url for mobile testing in appium如何在appium中找到当前用于移动测试的url
【发布时间】:2017-09-18 14:31:26
【问题描述】:

我正在使用 appium selenium 进行自动化测试。谁能帮我找到移动驱动程序的当前网址。尝试使用 driver.getCurrentUrl() 。它不工作

【问题讨论】:

    标签: appium


    【解决方案1】:
    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()
                }
    

    【讨论】:

    • 感谢您的回复..我会尝试并让您知道
    猜你喜欢
    • 2016-08-23
    • 2021-05-05
    • 1970-01-01
    • 2018-05-18
    • 2022-07-09
    • 1970-01-01
    • 1970-01-01
    • 2021-07-31
    • 2018-11-08
    相关资源
    最近更新 更多