Hey there! any question in your mind? Ask It Now!.

Popular Categories





How to handle iframe having not any Identifier in Selenium Webdriver?

0 votes
509 views
asked in Software Testing by nitin (810 points)

Hello guys I am stuck on this trying to switch a frame some how frame does not any Identifier like id or class, This is the HTML code here : 

<section class="box">
        <h3>See this</h3>
        <iframe src="http://xyz.com/id=6" scrolling="no" frameborder="0" height="340" width="100%"></iframe>
 
</section>
I have already handled iframe in webdriver by giving the name of iframe like this 
 
driver.switchTo().frame(frameid);
But in this case I am stuck.Please help me out in the same thanks! 

 

1 Answer

+3 votes
answered by Himanshu Expert (5,940 points)
selected by nitin
 
Best answer
Hello Nitin,
 
I got your problem even i have faced the same problem some how I found its solution, You need to just do this see :
 
 driver.switchTo().frame(0);
 
This means if you have n number of iframes you can handle them by 0,1,2,3 etc. in case when iframe does not have any
 
Identifier.
 
I hope you got my point. 
commented by nitin (810 points)
Thanks @Himanshu it helped me,when i put (0) in the place of iframe ID i switched successfully into the frame.
Keep sharing your knowledge...
commented by tester (1,550 points)
I was faced same problem thanks @Himanshu for the solution.

Related Questions

+1 vote
1 answer 536 views

Not a Member yet?

Ask to Folks Login

My Account
159 Folks are online
0 members and 159 guest online
Your feedback is highly appreciated