Here is the simple example how to switch between frames.
There are three ways to switch between frames.
INDEX:
Frame(int index)
Select a frame by its (zero-based) index. That is, if a page has three frames, the first frame would be at index "0", the second at index "1" and the third at index "2". Once the frame has been selected, all subsequent calls on the WebDriver interface are made to that frame.
There are three ways to switch between frames.
INDEX:
Frame(int index)
Select a frame by its (zero-based) index. That is, if a page has three frames, the first frame would be at index "0", the second at index "1" and the third at index "2". Once the frame has been selected, all subsequent calls on the WebDriver interface are made to that frame.
ID OR NAME:
frame(java.lang.String nameOrId)
Select a frame by its name or ID. Frames located by matching name attributes are always given precedence over those matched by ID.Frame(WebElement frameElement)Select a frame using its previously located webelementParameters:frameElement
- The frame element to switch to.
DEFAULTCONTENT()Selects either the first frame on the page, or the main document when a page contains iframes.- Below example explain you how to switch between frames.
- =============================================================
- package testng; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; public class Frames { public WebDriver driver; @BeforeClass public void beforeClass() { driver=new FirefoxDriver(); driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); } @Test public void testFrames() throws Exception { driver.navigate().to("http://jqueryui.com/"); driver.findElement(By.linkText("Autocomplete")).click(); //index // driver.switchTo().frame(0); //id or Name //in this example Frame is not having ID or Name so this is invalid here //driver.switchTo().frame("nameorid"); //frameElement driver.switchTo().frame(driver.findElement(By.className("demo-frame"))); //type in text box.. driver.findElement(By.id("tags")).sendKeys("java"); Thread.sleep(5000); //switch back to default content driver.switchTo().defaultContent(); driver.findElement(By.linkText("Accordion")).click(); Thread.sleep(5000); } @AfterClass public void afterClass() { driver.quit(); } }
I blog quite often and I really appreciate your content.
ReplyDeleteYour article has really peaked my interest. I am going to bookmark your blog and keep checking for new details about once a week.
I opted in for your Feed as well.
Feel free to surf my web blog ... skin bleach
What's up Dear, are you actually visiting this site regularly, if so after that you will definitely get good know-how.
ReplyDeleteMy web site : how to lose man breast
May I just say what a relief to find someone who truly understands
ReplyDeletewhat they're discussing on the internet. You actually understand how to bring a problem to light and make it important. A lot more people must read this and understand this side of the story. It's surprising you're not more popular given that you definitely possess the gift.
Feel free to surf my blog :: http://nigeriain.com
May I just say what a relief to find someone
ReplyDeletewho truly understands what they're discussing on the internet. You actually understand how to bring a problem to light and make it important. A lot more people must read this and understand this side of the story. It's surprising you're not more popular given that you definitely possess the gift.
my web site :: http://nigeriain.com
Remarkable! Its really awesome article, I have
ReplyDeletegot much clear idea on the topic of from this paragraph.
Here is my blog post: forex trading made easy
Hey very interesting blog!
ReplyDeleteMy website - best online Jobs
Write more, thats all I have to say. Literally, it
ReplyDeleteseems as though you relied on the video to make your point.
You obviously know what youre talking about, why throw away your
intelligence on just posting videos to your blog when you could
be giving us something enlightening to read?
Also visit my webpage ... ways to make extra money
always i used to read smaller articles that also clear their motive, and that is also happening
ReplyDeletewith this article which I am reading now.
Visit my web blog - forex classes
Having read this I thought it was extremely enlightening.
ReplyDeleteI appreciate you taking the time and effort to put this information together.
I once again find myself personally spending a lot of time
both reading and posting comments. But so what, it was still worth it!
Feel free to surf to my page; make money online now
If you are going for best contents like me, simply go
ReplyDeleteto see this web page all the time because it presents quality contents, thanks
my web-site ... earning money online
This is my first time visit at here and
ReplyDeletei am in fact impressed to read all at one place.
Also visit my blog post: how to make fast money online
Just want to say your article is as astounding. The clearness in your post is just great and i could assume you
ReplyDeleteare an expert on this subject. Fine with your permission allow me to
grab your RSS feed to keep up to date with forthcoming post.
Thanks a million and please keep up the rewarding work.
Check out my blog ... how to make a lot of money fast
Hello! I simply would like to offer you a huge thumbs up for your excellent
ReplyDeleteinformation you have right here on this post. I am coming back to
your site for more soon.
Also visit my web site work online from home
I visited multiple web sites except the audio feature for audio songs current at this web
ReplyDeletepage is actually marvelous.
Have a look at my web page how can i Make extra money
When someone writes an post he/she keeps the idea of a user
ReplyDeletein his/her brain that how a user can know it.
Thus that's why this paragraph is amazing. Thanks!
My blog post; make money free online
You need to take part in a contest for one of the greatest
ReplyDeletesites online. I'm going to highly recommend this web site!
My blog :: I need money today for free
My website - i need money now for free
Fabulous, what a weblog it is! This weblog presents helpful data
ReplyDeleteto us, keep it up.
my webpage - how to make money fast without a job
Amazing & Great informative blog,it gives very useful practical information to developer like me. Besides that Wisen has established as Best Java Online Training from India . or learn thru Online Training mode Hibernate Online Training . Nowadays Hibernate ORM has tons of job opportunities on various vertical industry. or learn thru JavaScript Online Training from India. Nowadays even JavaScript has tons of job opportunities on various vertical industry.
ReplyDelete