javascript - Web Driver: How to know current frame activeness? - Stack Overflow

I'm having 15 frames in a page where I need to move in and out,How I can I e to know under which f

I'm having 15 frames in a page where I need to move in and out,

How I can I e to know under which frame i'm in?

e.g From frame1 to frame8 and frame8 to frame12 and so on...

I'm having 15 frames in a page where I need to move in and out,

How I can I e to know under which frame i'm in?

e.g From frame1 to frame8 and frame8 to frame12 and so on...

Share Improve this question asked Jun 16, 2012 at 9:05 Nimeshkumar PrajapatiNimeshkumar Prajapati 412 silver badges11 bronze badges 3
  • by frame do you mean iframe or div? – jcolebrand Commented Jun 16, 2012 at 9:08
  • You can't know which iframe has the focus, and relay that to another iframe. You could potentially track the mouse position based on activity in a frame and associate it with a keyvalue used to load the URL from the master page, but that's terribly convoluted. Whats your intent? – jcolebrand Commented Jun 16, 2012 at 9:11
  • 1 wd.switchTo().defaultContent(); //Switching to Sub frame wd.switchTo().frame("canvas_frame"); One frame's out put is an input of another one and so on... – Nimeshkumar Prajapati Commented Jun 16, 2012 at 9:13
Add a ment  | 

1 Answer 1

Reset to default 4

In WebDriver, you explicitly have to switch into a frame or iframe via driver.switchTo().frame() (or its equivalent in whatever language binding you're using). As such, you should always know which frame or iframe you're in, because you switched to it. If you find you need to keep track of it for some reason, you might try something like adding an object to a list every time you switch to a frame or iframe. You can't switch to a parent or sibling frame in WebDriver, so to navigate to one of those, you'll need use driver.switchTo().defaultContent(), which will always switch to the top-level frame, and navigate down the hierarchy again.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745317864a4622300.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信