org.openqa.selenium.NoSuchElementException: Returned node (null) was not a DOM element when trying to locate card-fields-iframe by CssSelector

后端 未结 3 725
南旧
南旧 2020-12-21 13:50

I am trying to locate an iframe by partial id. For this method, I used: driver.switchTo().frame(driver.findElement(By.cssSelector(\"iframe[id*=\'card-fields-number\']

3条回答
  •  佛祖请我去吃肉
    2020-12-21 14:27

    As the iframe has tag iframe, you can switch to the iframe using the tagname like:
    driver.switchTo().frame(driver.findElement(By.tagName("iframe")));
    And if you want to again switch to the default content, then you can use driver.switchTo().defaultContent();

提交回复
热议问题