在硒中输入iframe [英] type into iframe in selenium

查看:171
本文介绍了在硒中输入iframe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在 iframe 中输入数据。我提到了

I need to type data into an iframe. I referred to

使用Selenium IDE键入IFrame

selenium.selectFrame(< xpath>)返回:找不到元素错误并且没有为 iframe 定义css。

but selenium.selectFrame(<xpath>) returns: Element not found error and no css has been defined for the iframe.

使用firebug:

<iframe frameborder="0" allowtransparency="true" tabindex="0" src="" title="Rich text editor, templateWizardCKEditor1, press ALT 0 for help." style="width: 100%; height: 100%;"/>

这可能是什么解决方案?

What could be a solution for this?

推荐答案

我找到了相同的解决方案......

I found a solution for the same...

driver.switchTo().frame("ext-gen298");
WebElement editable = driver.switchTo().activeElement();
editable.sendKeys("Your text here");
driver.switchTo().defaultContent();

参考: http://code.google.com/p/seleniumwikiFrequentlyAskedQuestions#Q:_How_do_I_type_into_a_contentEditable_iframe

这篇关于在硒中输入iframe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆