-
Notifications
You must be signed in to change notification settings - Fork 98
click with offset x y #138
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
base: master
Are you sure you want to change the base?
Conversation
This is quite technical, especially with the name. Furthermore how is the offset calculated? Maybe it would be better to name it something like: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also add documentation to BrowserTest page in examples.
Please ensure all method parameter definitions have a space after a comma.
@@ -716,6 +716,29 @@ protected boolean doubleClick(WebElement element) { | |||
return result; | |||
} | |||
|
|||
@WaitUntil | |||
public boolean clickWithOffsetXY(String place,int xOffset,int yOffset) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spaces after ,
... ;-)
protected boolean clickWithOffsetXY(WebElement element,int xOffset,int yOffset) { | ||
boolean result = false; | ||
if (element != null) { | ||
scrollIfNotOnScreen(element); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we not scroll to the location where we are going to click? Maybe first scroll to the element, and then scroll with the offset?
@@ -967,6 +967,10 @@ public void doubleClick(WebElement element) { | |||
getActions().doubleClick(element).perform(); | |||
} | |||
|
|||
public void clickWithOffset(WebElement element,int xOffset,int yOffset) { | |||
getActions().moveToElement(element, xOffset, yOffset ).click().build().perform(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to call build, you can just call perform()
after click.
I now see that the offset is relative to top left hand corner of element. That needs to be in documentation...
@@ -0,0 +1,54 @@ | |||
--- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appreciate the test!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well i cant seem to bypass this unneeded change request.
Added the documentation on technical part, well getActions() is public now so i can always move this to an extended version |
e8e47f4
to
b481101
Compare
@@ -56,6 +56,7 @@ The heuristic to find places tries a number of translations of end user terms to | |||
|scroll to <place> |scrolls the designated place into view | | |||
|hover over <place> |simulates hovering over the designated place with the mouse (so e.g. 'mouseover' behavior can be tested) | | |||
|drag and drop <place> to <target> |drags the designated place to the target (does not work for HTML5 drag 'n' drop, because of [[Selenium issue][https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/3604]]) | | |||
|click with offset <place> X <XinPixels> Y <YinPixels> |clicks with a offset X,Y (offset measured in pixels of Top Left corner of element) | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In your test you actually use: click <place> with offset X <horizontalOffset> Y < verticalalOffset >
I have to say I like that better.
Why is 'Top Left' capitalised?
b481101
to
2d24bec
Compare
No description provided.