2016-08-01 12 views
0

と相互作用することはできませんではありませんそれはここでSelenium::WebDriver::Error::ElementNotVisibleError: Element is not currently visible and so may not be interacted withセレンの要素は、現在、私はこのようなページを持っている目に見えるので、

をスローそのうちの一つの鍵は、私の運転指令です:

browser.browser.public_send(:textareas, :xpath => "//div[@class='CodeMirror']//textarea[@wrap='off']")[0].html 
 
=> "<textarea autocapitalize=\"off\" autocorrect=\"off\" style=\"position: absolute; padding: 0px; width: 1px; height: 1em;\" wrap=\"off\"></textarea>" 
 
[58] pry(#<CucuShift::DefaultWorld>)> browser.browser.public_send(:textareas, :xpath => "//div[@class='CodeMirror']//textarea[@wrap='off']")[1].html 
 
=> "<textarea autocapitalize=\"off\" autocorrect=\"off\" style=\"position: absolute; padding: 0px; width: 1px; height: 1em;\" wrap=\"off\"></textarea>" 
 

 
browser.browser.public_send(:textareas, :xpath => "//div[@class='CodeMirror']/descendant::textarea[@autocorrect='off']")[1].click 
 

 
Selenium::WebDriver::Error::ElementNotVisibleError: Element is not currently visible and so may not be interacted with 
 
from [remote server] file:///tmp/webdriver-profile20160801-26332-bu7605/extensions/[email protected]/components/command-processor.js:10092:in `fxdriver.preconditions.visible' 
 

 
browser.browser.public_send(:textareas, :xpath => "//div[@class='CodeMirror']/descendant::textarea[@autocorrect='off']")[1].send_keys '1234' 
 

 
Selenium::WebDriver::Error::ElementNotVisibleError: Element is not currently visible and so may not be interacted with 
 
from [remote server] file:///tmp/webdriver-profile20160801-26332-bu7605/extensions/[email protected]/components/command-processor.js:10092:in `fxdriver.preconditions.visible'

最も奇妙なことは、これらのあまりに要素HTMLは同じです。

答えて

0

あなたがtextareaにアクセスできないのは、textareaの親divに属性 "overflow:hidden"があることです。 したがって、あなたのテキストエリアは見えません。コードから "overflow:hidden"属性を削除すると、テキストエリアが表示され、Seleniumで手動でアクセスすることができます。

査読者への注:実際、質問自体は明らかではありません。私はタイトルに頼って答えようとしました。ユーザーはWeb要素とやりとりしたいのですが、私の答えは解決策を提供します。

+0

実際、CodeMirrorの問題です –

関連する問題