Selenium webdriver 如何为webdriver.io中不可见的文本输入设置值?
使用Selenium webdriver 如何为webdriver.io中不可见的文本输入设置值?,selenium-webdriver,webdriver,cucumber,cucumberjs,Selenium Webdriver,Webdriver,Cucumber,Cucumberjs,使用browser.setValue(XPathof元素,4242)返回: An element command could not be completed because the element is in an invalid state 我确实试着做了休闲,使画面聚焦: browser.waitForVisible('//iframe[@id="myFrameId"]', 6000); browser.frame('myFrameId'); 但我得到了同样的结果。我是否正确地进行了上
browser.setValue(XPathof元素,4242)返回:
An element command could not be completed because the element is in an invalid state
我确实试着做了休闲,使画面聚焦:
browser.waitForVisible('//iframe[@id="myFrameId"]', 6000);
browser.frame('myFrameId');
但我得到了同样的结果。我是否正确地进行了上下文切换?因为该字段在视觉上是可见的,并且可以使用键盘输入进行编辑。尝试删除waitForVisible的等待时间,并以这种方式进行测试
browser.waitForVisible('iframe[id=“yourIframeId”]”);
var my_frame=$('iframe[id=“yourIframeId”]”)值;
browser.frame(我的框架)代码>
然后对iframe元素的其余测试Selenium不喜欢与它看不见的东西交互。它的交互基于实际用户可以做什么。