2

logs:

Organization flow Successfull case Organization should be created successfully.
     Failure/Error: find('#submit_requirements_crawl_type_1', visible: false).click

     Selenium::WebDriver::Error::ElementNotVisibleError:
       element not interactable
         (Session info: headless chrome=72.0.3626.119)
         (Driver info: chromedriver=2.46.628388 (4a34a70827ac54148e092aafb70504c4ea7ae926),platform=Linux 4.9.0-7-amd64 x86_64)

I tried maximum examples that were present in stack overflow and couple of other sites.

Few code samples:

find(:xpath, "//label[@for='submit_requirements_crawl_type_1']").click
find(:xpath, "//label[@for='submit_requirements_output_format_0']").click

find('#submit_requirements_crawl_type_1', visible: false).click
find('#submit_requirements_output_format_0', visible: false).click

find('label', text: "submit_requirements_crawl_type_2").click
find('label', text: "submit_requirements_output_format_0").click

choose('Full Crawl', :visible => true)
choose('JSON', :visible => true)




<div class="radio radio-info radio-inline">
      <input type="radio" value="1" name="submit_requirements[crawl_type]" id="submit_requirements_crawl_type_1">
      <label for="submit_requirements_crawl_type_1">Full Crawl</label>
    </div>

Note:

It working fine in development environment with both headless and head chrome webdriver

Ganesh Raju
  • 95
  • 1
  • 14

1 Answers1

2

If you have to specify visible: false in order to locate an element you won't be able to click it since you can't click elements that aren't visible on the page.

Seeing that it's a radio button my initial reaction is that you have CSS that is hiding the actual radio button and replacing it with an image for styling reasons (make it look like a toggle, etc). If that is the case then you can have Capybara click on the label instead with

choose('Full Crawl', allow_label_click: true)

However, assuming your statement "It working fine in development environment with both headless and head chrome webdriver" means you've run the tests in the dev environment and they're fine it would tend to indicate you have an error somewhere in your JS. In the dev environment an error in one JS file doesn't prevent the rest of the JS files from being processed, however in the test (and production) environment the JS files are concatenated into one file which means an error in any file can prevent JS concatenated after that error from being run. Check your browser console when visiting the page and fix any errors reported.

Thomas Walpole
  • 48,548
  • 5
  • 64
  • 78