Unable to identify the element inside another html

57 views
Skip to first unread message

kishore reddy

unread,
Apr 29, 2015, 9:27:54 AM4/29/15
to seleniu...@googlegroups.com
I 'm trying to identify the element DivToFind using selenium WebDriver. But, as they are inside a frame and then inside another html, i'm unable to find it.

Even though switchTo().frame() is successful, as there is another <html> starts, the code is unable to identify the elements inside.

For more details:
2. Add a product
3. click on vie Shopping Bag button
4. In Shopping Bag page, click on VisaCheckout button
5. Visa Checkout screen should open(It is like Popup but its not a popup actually)
6. Try locating any element on VisaCheckout Screen

Unable to identify here

Please help me in finding the solution

brandon garlock

unread,
Apr 29, 2015, 9:19:55 PM4/29/15
to seleniu...@googlegroups.com
Took a look. I don't have a lot of experience with using iFrames and selenium. But I found if I put in a wait I have no problems locating the userName in the iFrame once it loads.

<tr>
<td>open</td>
<td>/checkout/cart.jsp?source=topnav</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>id=vmeimg1</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>id=userName</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>id=userName</td>
<td>This is a test</td>
</tr>

Abhishek Singh

unread,
Apr 30, 2015, 1:55:58 AM4/30/15
to seleniu...@googlegroups.com
Hi Kishore,
Do we need to be a registered user to see the VisaCheckOutScreen?
If yes, can you please share some test accounts to repro the above steps.
I am unable to repro the behavior at my end on Chrome Browser 42 with above steps.

Regards,
Abhishek

Chirag Khimani

unread,
May 1, 2015, 12:46:57 AM5/1/15
to seleniu...@googlegroups.com

I have faced the same issue. I user below workaround

 String src = Element.getAttribute("src");
 driver.get(src);


Now you can find element with the same locator you are trying.

Thanks
Chirag


On Wednesday, April 29, 2015 at 6:57:54 PM UTC+5:30, kishore reddy wrote:

tulsi.tester

unread,
May 4, 2015, 4:22:51 AM5/4/15
to seleniu...@googlegroups.com
Silly, but important to know  whether you have switched to the frame before finding the element inside another html?. If not switched please switch to the frame by using driver.switchTo().frame("frame id"). See api for further options to switch to frame.


On Wednesday, April 29, 2015 at 6:57:54 PM UTC+5:30, kishore reddy wrote:
Reply all
Reply to author
Forward
0 new messages