mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Handle selenium 4 ref response change
This commit is contained in:
parent
12b9e1650e
commit
b045ef807c
4 changed files with 9 additions and 4 deletions
|
@ -484,6 +484,12 @@ private
|
|||
JS
|
||||
end
|
||||
|
||||
def native_id
|
||||
# Selenium 3 -> 4 changed the return of ref
|
||||
type_or_id, id = native.ref
|
||||
id || type_or_id
|
||||
end
|
||||
|
||||
GET_XPATH_SCRIPT = <<~'JS'
|
||||
(function(el, xml){
|
||||
var xpath = '';
|
||||
|
|
|
@ -63,9 +63,8 @@ class Capybara::Selenium::ChromeNode < Capybara::Selenium::Node
|
|||
|
||||
def visible?
|
||||
return super unless native_displayed?
|
||||
|
||||
begin
|
||||
bridge.send(:execute, :is_element_displayed, id: native.ref)
|
||||
bridge.send(:execute, :is_element_displayed, id: native_id)
|
||||
rescue Selenium::WebDriver::Error::UnknownCommandError
|
||||
# If the is_element_displayed command is unknown, no point in trying again
|
||||
driver.options[:native_displayed] = false
|
||||
|
|
|
@ -69,7 +69,7 @@ class Capybara::Selenium::EdgeNode < Capybara::Selenium::Node
|
|||
return super unless chrome_edge? && native_displayed?
|
||||
|
||||
begin
|
||||
bridge.send(:execute, :is_element_displayed, id: native.ref)
|
||||
bridge.send(:execute, :is_element_displayed, id: native_id)
|
||||
rescue Selenium::WebDriver::Error::UnknownCommandError
|
||||
# If the is_element_displayed command is unknown, no point in trying again
|
||||
driver.options[:native_displayed] = false
|
||||
|
|
|
@ -76,7 +76,7 @@ class Capybara::Selenium::FirefoxNode < Capybara::Selenium::Node
|
|||
return super unless native_displayed?
|
||||
|
||||
begin
|
||||
bridge.send(:execute, :is_element_displayed, id: native.ref)
|
||||
bridge.send(:execute, :is_element_displayed, id: native_id)
|
||||
rescue Selenium::WebDriver::Error::UnknownCommandError
|
||||
# If the is_element_displayed command is unknown, no point in trying again
|
||||
driver.options[:native_displayed] = false
|
||||
|
|
Loading…
Add table
Reference in a new issue