-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
fix: add webdrivererror handler instead of calling just name #66
Conversation
Thanks! I think your fix is good. I'll check this |
@KazuCocoa I tried this change in my use-case. iOS is OK, but android is wrong.
Maybe when we cann't get element existence, we can't get example/vendor/bundle/ruby/2.7.0/gems/capybara-3.38.0/lib/capybara/selenium/node.rb def tag_name
@tag_name ||=
if native.respond_to? :tag_name
native.tag_name.downcase
else
shadow_root? ? 'ShadowRoot' : 'Unknown'
end
end ==== spec/android_example_spec.rb require_relative 'spec_helper'
describe 'API app smoke test' do
it 'samle test' do
home_page = Pages::Android.new
expect(home_page.list.media_item).to be_truthy
expect(home_page.list.has_missed_item?).to be_falsey #<- error occurred
end
end android_page.rb module Pages
class Android < ::SitePrism::Page
section :list, :class, 'android.widget.ListView' do
elements :media_item, :class, 'android.widget.TextView', text: 'Media' #exist_item
elements :missed_item, :class, 'android.widget.TextView', text: 'missed' #no_exist item
end
end =====
|
Let me check Android later. The endpoint (tag_name) called Or I missed something in the capybara. Let me check further |
so... this capybara node overrided the node as https://github.com/appium/appium_capybara/blob/master/lib/appium_capybara/driver/appium/node.rb#L27-L29 . Then, your change |
Thank you for your checking! |
Instead of #62, maybe we could try the rescue clause when the primary method gets Selenium WebDriver exception.
the tag name is https://w3c.github.io/webdriver/#get-element-tag-name in the w3c spec while the "name" is Appium specific. So, when we consider the WebContext as well, it would be safe to keep the primary method in capybara. Instead, the rescue clause can have
::Selenium::WebDriver::Error::WebDriverError
as well so that the method can try out thetag_name
. (in fact of the tag_name, Ruby client calls/session/{session id}/element/{element id}/name
endpoint as the spec.This case also get passed for the given scenario https://github.com/appium/appium_capybara/pull/62/files
cc @teyamagu