New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modal issue - (Selenium::WebDriver::Error::ElementNotInteractableError) #6377

Closed
BigGorillaMike opened this Issue Sep 6, 2018 · 6 comments

Comments

Projects
None yet
3 participants
@BigGorillaMike

BigGorillaMike commented Sep 6, 2018

Meta -

Linux Xvfb style
ruby-2.1.1/gems/selenium-webdriver-3.11.0/

Code I have written in Ruby

require 'rubygems'
require 'headless'
require 'selenium-webdriver'

headless = Headless.new(display: 99)
headless.start

Selenium::WebDriver.logger.level = :info
--# Selenium::WebDriver.logger.level = :debug #uncomment this if you need to debug
--# opts = Selenium::WebDriver::Firefox::Options.new(log_level: :trace) #uncomment this if you need to debug

capabilities = Selenium::WebDriver::Remote::Capabilities.firefox(accept_insecure_certs: true)

driver = Selenium::WebDriver.for :firefox, desired_capabilities: capabilities#, options: opts #uncomment this if you need to debug
driver.navigate.to 'https://fpdev1098twebsite-env-11.us-east-1.elasticbeanstalk.com/'
puts driver.title

dropDown = driver.find_element(id: 'signInChange')
puts dropDown.displayed?
dropDown.click

student = driver.find_element(name: 'student').click
puts driver.title

wait = Selenium::WebDriver::Wait.new(:timeout => 500)
wait.until {driver.find_element(id: 'username')}

driver.find_element(id: 'username').send_keys '#removed#'
driver.find_element(id: 'password').send_keys '#removed#
driver.find_element(name: 'signInSubmitButton').click

puts driver.title

headless.destroy

Expected Behavior -

I expect it to be able to log in

Actual Behavior - I get the following error

{"value":{"error":"element not interactable","message":"Element <input id="username" class="form-control inputField-customizable" name="username" type="text"> is not reachable by keyboard","stacktrace":"WebDriverError@chrome://marionette/content/error.js:178:5\nElementNotInteractableError@chrome://marionette/content/error.js:286:5\nwebdriverSendKeysToElement@chrome://marionette/content/interaction.js:562:11\ninteraction.sendKeysToElement@chrome://marionette/content/interaction.js:549:11\nsendKeysToElement@chrome://marionette/content/listener.js:1320:9\ndispatch/</req<@chrome://marionette/content/listener.js:489:14\ndispatch/<@chrome://marionette/content/listener.js:484:15\n"}}
WebDriverError@chrome://marionette/content/error.js:178:5: Element is not reachable by keyboard (Selenium::WebDriver::Error::ElementNotInteractableError)

Steps to reproduce -

Run the script.

##Edit
I had a screenshot taken of the page before trying to send_keys to username, attaching the screenshot. which makes this harder for me to understand because clearly the fields are there, don't know why they cannot be selected.

screenshots

@twalpole

This comment has been minimized.

Show comment
Hide comment
@twalpole

twalpole Sep 7, 2018

Contributor

@BigGorillaMike there are two elements with an id of username (not valid HTML) on that page - you're finding the first one and it is not keyboard interactable.

Contributor

twalpole commented Sep 7, 2018

@BigGorillaMike there are two elements with an id of username (not valid HTML) on that page - you're finding the first one and it is not keyboard interactable.

@barancev

This comment has been minimized.

Show comment
Hide comment
@barancev

barancev Sep 7, 2018

Member

This is a question rather than an issue. Please send questions to the selenium user group

Member

barancev commented Sep 7, 2018

This is a question rather than an issue. Please send questions to the selenium user group

@barancev barancev closed this Sep 7, 2018

@BigGorillaMike

This comment has been minimized.

Show comment
Hide comment
@BigGorillaMike

BigGorillaMike Sep 7, 2018

Thanks @twalpole, I wrote for keyboard nav and it works

driver.action.send_keys(:tab).perform
driver.action.send_keys('#removed#').perform
driver.action.send_keys(:tab).perform
driver.action.send_keys('#removed#').perform
driver.action.send_keys(:return).perform

BigGorillaMike commented Sep 7, 2018

Thanks @twalpole, I wrote for keyboard nav and it works

driver.action.send_keys(:tab).perform
driver.action.send_keys('#removed#').perform
driver.action.send_keys(:tab).perform
driver.action.send_keys('#removed#').perform
driver.action.send_keys(:return).perform

@twalpole

This comment has been minimized.

Show comment
Hide comment
@twalpole

twalpole Sep 9, 2018

Contributor

@BigGorillaMike You don't really need to resort to actions, you just need to make sure you find the correct element

driver.find_element(:css, 'div.visible-lg #username').send_keys(...)
Contributor

twalpole commented Sep 9, 2018

@BigGorillaMike You don't really need to resort to actions, you just need to make sure you find the correct element

driver.find_element(:css, 'div.visible-lg #username').send_keys(...)
@BigGorillaMike

This comment has been minimized.

Show comment
Hide comment
@BigGorillaMike

BigGorillaMike Sep 10, 2018

@twalpole thanks, I was wondering if that would work, but wasn't sure how to write it, this being my first attempt with selenium and it also being the first use of selenium for this company.

BigGorillaMike commented Sep 10, 2018

@twalpole thanks, I was wondering if that would work, but wasn't sure how to write it, this being my first attempt with selenium and it also being the first use of selenium for this company.

@twalpole

This comment has been minimized.

Show comment
Hide comment
@twalpole

twalpole Sep 10, 2018

Contributor

@BigGorillaMike You’re welcome. If you’re using Ruby in your new project you will probably have a much easier time using Selenium via Capybara or Watir rather than using Selenium directly.

Contributor

twalpole commented Sep 10, 2018

@BigGorillaMike You’re welcome. If you’re using Ruby in your new project you will probably have a much easier time using Selenium via Capybara or Watir rather than using Selenium directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment