I want to click the "button" below, but cannot click it.
The html is:
<table onclick="filtersJob_intrinsic_extender.addRow();return false;" class="FilterList_addLink">
<tbody>
<tr>
<td class="icon"><img src="/commander/lib/images/icn12px_add.gif" alt="Add Filter"></td>
<td class="text">Add Intrinsic Filter</td>
</tr>
</tbody>
</table>
I am basically doing this with watir and watir-webdriver:
browser.td(:text => 'Add Intrinsic Filter').click
I tried this method on another similar button in another website and it worked. I wonder why it does not work here.
It causes the exception:
Selenium::WebDriver::Error::ElementNotVisibleError in 'your rspec spec code'
Element is not currently visible and so may not be interacted with[remote server] file:///C:/Users/john/AppData/Local/Temp/webdriver-profile20150402-8208-15kr0zm/extensions/[email protected]/components/command_processor.js:7736:in `fxdriver.preconditions.visible'
[remote server] file:///C:/Users/john/AppData/Local/Temp/webdriver-profile20150402-8208-15kr0zm/extensions/[email protected]/components/command_processor.js:10437:in `DelayedCommand.prototype.checkPreconditions_'
[remote server] file:///C:/Users/john/AppData/Local/Temp/webdriver-profile20150402-8208-15kr0zm/extensions/[email protected]/components/command_processor.js:10456:in `DelayedCommand.prototype.executeInternal_/h'
[remote server] file:///C:/Users/john/AppData/Local/Temp/webdriver-profile20150402-8208-15kr0zm/extensions/[email protected]/components/command_processor.js:10461:in `DelayedCommand.prototype.executeInternal_'
[remote server] file:///C:/Users/john/AppData/Local/Temp/webdriver-profile20150402-8208-15kr0zm/extensions/[email protected]/components/command_processor.js:10401:in `DelayedCommand.prototype.execute/<'
C:/ruby/lib/ruby/gems/1.8/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/response.rb:51:in `assert_ok'
C:/ruby/lib/ruby/gems/1.8/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/response.rb:15:in `initialize'
C:/ruby/lib/ruby/gems/1.8/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/http/common.rb:59:in `new'
C:/ruby/lib/ruby/gems/1.8/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/http/common.rb:59:in `create_response'
C:/ruby/lib/ruby/gems/1.8/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/http/default.rb:66:in `request'
C:/ruby/lib/ruby/gems/1.8/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
C:/ruby/lib/ruby/gems/1.8/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/bridge.rb:629:in `raw_execute'
C:/ruby/lib/ruby/gems/1.8/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/bridge.rb:607:in `execute'
C:/ruby/lib/ruby/gems/1.8/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/bridge.rb:364:in `clickElement'
C:/ruby/lib/ruby/gems/1.8/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/common/element.rb:54:in `click'
browser.tds(:text => 'Add Intrinsic Filter').length
? – Cranial//tr[@id='filtersJob_intrinsic_container']/td[2]/table[2]/tbody/tr/td[2]
. thanks. – Intentbrowser.tds(:text => 'Add Intrinsic Filter').map(&:visible?).uniq
– Cranialu = browser.tds(:text => 'Add Intrinsic Filter').map(&:visible?).uniq; puts u
Output is false, true. Btw, what does this do -.map(&:visible?).uniq
– Intentmap(&:visible?)
says to collect the result of calling.visible?
for each cell in the collection (into an array)..uniq
takes the array and just outputs the unique values. Given that the result was[false, true]
, it means that some of the cells are visible and some are not. – Cranial