Hirurg103
Hirurg103

Reputation: 4953

Selenium::WebDriver::Error::ElementNotVisibleError: element not interactable

I need to select a colour in my acceptance tests. The hidden colour field is rendered with [email protected]. I use the following code to set the colour:

find('#colour', visible: false).set('#fefacb')

I use capybara (3.11.1), selenium-webdriver (3.141.0) and ChromeDriver 2.44.609545 (c2f88692e98ce7233d2df7c724465ecacfe74df5). I run the tests in headless mode

But my test fails with:

element not interactable
  (Session info: chrome=70.0.3538.110)
  (Driver info: chromedriver=2.43.600229 (3fae4d0cda5334b4f533bede5a4787f7b832d052),platform=Mac OS X 10.14.1 x86_64) (Selenium::WebDriver::Error::ElementNotVisibleError)

What is wrong with my code? How can I fix it?

Upvotes: 3

Views: 3411

Answers (1)

Thomas Walpole
Thomas Walpole

Reputation: 49880

Just like a user wouldn't be able to, you can't interact (set, click, etc) with non-visible fields. Instead you need to interact with the visible elements on the page created by jquery-minicolors -- What those elements would be is completely dependent on how you've configured jquery-minicolors but should be relatively obvious by inspecting the page.

Upvotes: 0

Related Questions