java - how to handle dynamically changing iframe id using selenium webdriver -


iframe id = pngNewCase1143241142570_iframe , this id dynamically changes every time. How do I < Strong> Selenium WebDriver Java I tried to use

  driver. SwitchTo (). Frame (driver.findElement (By.xpath ("Xrath's iframe changes dynamically"))); . Driver.switchTo () defaultContent ();   

but did not work for me

Also tried

  driver.switchTo (). Frame (driver.findElement (by .id ("pngNewCase1143241142570_iframe"))); . Driver.switchTo () defaultContent ();   

Anyone can help me please

If you Try to mention the IFrame Src attribute in this ur xpath declaration. This is working for me like the following:

  WebElement frame = driver.findElement (By.xpath ("// iframe [@ src = 'showNewClaimForm.action']"); Driver. SwitchTo (). Frame (frame);    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -