Skip to main content
added 5 characters in body
Source Link
alecxe
  • 11.4k
  • 11
  • 51
  • 107

I actually found out why the above was not working.

The issue is that it was inside an iframeiframe.

<iframe id="index_reg_iframe" src="/main.php? a=user.register_iframe_fp&amp;no_header=1&amp;btn_bg_next=447DC3&amp;btn_ bg_next_hover=396ba8&amp;id=noadvert&amp;prg=1&amp;tour=1&amp;pg=1" marginwidth="0" marginheight="0" hspace="0" vspace="0" scrolling="no" allowtransparency="true" height="450" frameborder="0" width="410"></iframe>

The following command worked for me.

driver.switchTo().frame("index_reg_iframe").findElement(By.xpath(".//*[@id='step1']/button")).click();

driver.switchTo().frame("index_reg_iframe").findElement(By.xpath(".//*[@id='step1']/button")).click();

Thank you guys for brainstorming with me.

I actually found out why the above was not working.

The issue is that it was inside an iframe.

<iframe id="index_reg_iframe" src="/main.php? a=user.register_iframe_fp&amp;no_header=1&amp;btn_bg_next=447DC3&amp;btn_ bg_next_hover=396ba8&amp;id=noadvert&amp;prg=1&amp;tour=1&amp;pg=1" marginwidth="0" marginheight="0" hspace="0" vspace="0" scrolling="no" allowtransparency="true" height="450" frameborder="0" width="410"></iframe>

The following command worked for me.

driver.switchTo().frame("index_reg_iframe").findElement(By.xpath(".//*[@id='step1']/button")).click();

Thank you guys for brainstorming with me.

I actually found out why the above was not working.

The issue is that it was inside aniframe.

<iframe id="index_reg_iframe" src="/main.php? a=user.register_iframe_fp&amp;no_header=1&amp;btn_bg_next=447DC3&amp;btn_ bg_next_hover=396ba8&amp;id=noadvert&amp;prg=1&amp;tour=1&amp;pg=1" marginwidth="0" marginheight="0" hspace="0" vspace="0" scrolling="no" allowtransparency="true" height="450" frameborder="0" width="410"></iframe>

The following command worked for me.

driver.switchTo().frame("index_reg_iframe").findElement(By.xpath(".//*[@id='step1']/button")).click();

Thank you guys for brainstorming with me.

Source Link
Christian
  • 375
  • 1
  • 5
  • 15

I actually found out why the above was not working.

The issue is that it was inside an iframe.

<iframe id="index_reg_iframe" src="/main.php? a=user.register_iframe_fp&amp;no_header=1&amp;btn_bg_next=447DC3&amp;btn_ bg_next_hover=396ba8&amp;id=noadvert&amp;prg=1&amp;tour=1&amp;pg=1" marginwidth="0" marginheight="0" hspace="0" vspace="0" scrolling="no" allowtransparency="true" height="450" frameborder="0" width="410"></iframe>

The following command worked for me.

driver.switchTo().frame("index_reg_iframe").findElement(By.xpath(".//*[@id='step1']/button")).click();

Thank you guys for brainstorming with me.