0 votes
1.3k views
in Software Testing by (1.3k 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! 

 

closed

1 Answer

+3 votes
by Expert (5.9k points)
selected by
 
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. 
0
by (1.3k 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...
0
by (1.6k points)
I was faced same problem thanks @Himanshu for the solution.

Not a Member yet?

Ask to Folks Login

My Account

Your feedback is highly appreciated