Hello everyone,
I’m trying to automating navigation using Hound, but I’m having some troubles with select/option elements and how to interact with them.
For instance, I tried in different ways to select an option from the site "https://www.imovelweb.com.br/."
I tried the solution below but didn’t work.
I’m using the selenium driver with the chrome browser.
$ brew install selenium-server-standalone
$ selenium-server -port 4444
use Mix.Config
config :hound,
driver: "selenium",
browser: "chrome"
I tried to select in the following ways:
def search() do
Hound.start_session()
navigate_to(@url)
find_element(:css, "#operationType option[value='1']")
|> click
#take_screenshot()
rescue
e ->
IO.inspect(e)
:notfound
after
Hound.end_session
end
Error
%RuntimeError{
message: "element not interactable: Element is not currently visible and may not be manipulated\n (Session info: chrome=79.0.3945.88)\nBuild info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'\nSystem info: host: 'Rodrigos-MacBook-Pro.local', ip: '2804:14c:4a:9f9d:1591:2820:1fe7:d763', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.15.2', java.version: '1.8.0_131'\nDriver info: driver.version: unknown"
}
def search() do
Hound.start_session()
navigate_to(@url)
find_element(:css, "#operationType")
|> find_within_element(:css, "option[value='1']")
|> click
#take_screenshot()
rescue
e ->
IO.inspect(e)
:notfound
after
Hound.end_session
end
Error
%RuntimeError{
message: "element not interactable: Element is not currently visible and may not be manipulated\n (Session info: chrome=79.0.3945.88)\nBuild info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'\nSystem info: host: 'Rodrigos-MacBook-Pro.local', ip: '2804:14c:4a:9f9d:1591:2820:1fe7:d763', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.15.2', java.version: '1.8.0_131'\nDriver info: driver.version: unknown"
}
I was wondering if I have to click on the select element before to show the options and then click on the chosen option, but when I tried to click on the select element I got another error.
def search() do
Hound.start_session()
navigate_to(@url)
find_element(:css, "#operationType")
|> click
#take_screenshot()
rescue
e ->
IO.inspect(e)
:notfound
after
Hound.end_session
end
Error
%RuntimeError{
message: "element not interactable\n (Session info: chrome=79.0.3945.88)\nBuild info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'\nSystem info: host: 'Rodrigos-MacBook-Pro.local', ip: '2804:14c:4a:9f9d:1591:2820:1fe7:d763', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.15.2', java.version: '1.8.0_131'\nDriver info: driver.version: unknown"
}
Thanks!