Selenium WebDriver does not find element by XPATH

前端 未结 1 1669
礼貌的吻别
礼貌的吻别 2021-01-24 08:14

I\'m trying to write a Selenium Testcase and started with the Selenium IDE in Firefox. The test is working quite fine there. Now I want to automate that test with Selenium Webdr

相关标签:
1条回答
  • 2021-01-24 08:33

    You can use findElement to get the frame webelement and have it used with the switchto() method.

    driver.switchTo().frame(driver.findElement(By.xpath("iframe[contains(@name=pngNewC‌​ase1143241142570_IFrame)]")));
    

    If you have some other attribute like src, you can try the below.

    WebElement frame=driver.findElement(By.xpath("//iframe[@src='showNewClaimForm.action']");
    driver.switchTo().frame(frame);
    
    0 讨论(0)
提交回复
热议问题