Selenium can't locate iframe

后端 未结 5 1483
栀梦
栀梦 2021-01-16 00:24

Selenium fails to locate the iframe by ID and Name.

This is for an automated checkout test on Shopify. The specific issue lies within the p

5条回答
  •  温柔的废话
    2021-01-16 01:05

    My solution was to look for keywords that are the exact same for different dynamic id's. In this case, it was "card-fields-name". I did this by using the XPath locator.

    driver.switchTo().frame(driver.findElement(By.xpath("//iframe[contains(@id,'card-fields-number')]")));
    

提交回复
热议问题