Skip to content
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

Handle tapping of buttons in WebViews #19

Open
ctrevarthen opened this issue Jul 29, 2019 · 0 comments
Open

Handle tapping of buttons in WebViews #19

ctrevarthen opened this issue Jul 29, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@ctrevarthen
Copy link
Contributor

For some reason, tapping buttons in WebViews doesn't seem to work reliably (at least in iOS). The buttons can be found, but tapping on them doesn't seem to work.

By tapping at a coordinate where the button is located, we should be able to work around this:

TestObject auth0_login_button = Finder.findButton('Auth0 Sign In Button')

// on retina displays, the pixel density is 2x (if might vary for other devices)
int screenScaleFactor = 2

// properties are stored as strings with decimals and can't be converted directly to integers
int x = Double.parseDouble(auth0_login_button.findPropertyValue('x')).toInteger() / screenScaleFactor
int y = Double.parseDouble(auth0_login_button.findPropertyValue('y')).toInteger() / screenScaleFactor
int height = Double.parseDouble(auth0_login_button.findPropertyValue('height')).toInteger() / screenScaleFactor
int width = Double.parseDouble(auth0_login_button.findPropertyValue('width')).toInteger() / screenScaleFactor

// tap in the middle of the button
// y value seems to be the BOTTOM of the element
MobileBuiltInKeywords.tapAtPosition(x + (width/2), y - (height/2))
@ctrevarthen ctrevarthen added the enhancement New feature or request label Jul 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant