【问题标题】:Windows Application: Switching to iframe window nested inside the same windowWindows 应用程序:切换到嵌套在同一窗口内的 iframe 窗口
【发布时间】:2020-10-23 03:28:48
【问题描述】:

首先,我尝试了driver.switchTo().frame("framename");,但它没有切换到那个。

driver.switchTo().frame("xxx");/// Throws an {"status":7,"value":{"error":"no such element","message":"An element could not be located on the page using the given search parameters."}}

深入研究后,我发现特定的框架定位器甚至不存在于页面源中。关于如何切换到该框架的任何想法。

附:我正在使用 WinApp 驱动程序。

注意:网络中的相同场景,我可以使用 switchTo iframe 元素进行切换。

【问题讨论】:

    标签: java windows selenium-webdriver winappdriver appium-desktop


    【解决方案1】:

    我认为你在这里不匹配。您需要在 frame(" ") 输入的不是字符串。应该是:

    driver.switchTo().frame(driver.find_element_by_xpath("xpath of the iframe"));
    

    【讨论】:

    • 即使在给出 xpath 之后,它也不会切换到框架。因为在页面源 iframe 元素中不存在。所以它不会在其中抛出这样的元素。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-24
    • 2016-04-25
    • 1970-01-01
    • 1970-01-01
    • 2017-07-11
    相关资源
    最近更新 更多