Ich habe eine Seite wie diese interagiert werden:Selen Element ist nicht sichtbar und so kann nicht mit
<div class="CodeMirror">
<div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 6.2px; left: 182.2px;">
\t <textarea autocapitalize="off" autocorrect="off" style="position: absolute; padding: 0px; width: 1px; height: 1em;" wrap="off"></textarea>
</div>
<div style="display: none; height: 106px;" class="CodeMirror-scrollbar"> <div style="height: 114px;" class="CodeMirror-scrollbar-inner"></div></div>
<div> ...
...
..
</div>
<pre style="top: 39px; left: 0px;" class="CodeMirror-cursor"> </pre>
<div style="">
<pre>asdf</pre>
<pre>asdfasdf</pre> It's weird the textarea content is here
<pre>asdfasdf</pre>
<pre> </pre>
</div>
...
...
und ich verwende Selen zu wählen, sondern erhalten zwei Elemente und ich sende Schlüssel zu einer von ihnen es Selenium::WebDriver::Error::ElementNotVisibleError: Element is not currently visible and so may not be interacted with
Hier ist meine Operation Befehl wirft:
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'
die seltsame Sache ist, diese auch Elemente html gleich sind.
Eigentlich ist es das Problem von CodeMirror –