Skip to content

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

teunisnl
Copy link
Contributor

No description provided.

@fhoeben
Copy link
Owner

fhoeben commented May 30, 2017

This is quite technical, especially with the name. Furthermore how is the offset calculated? Maybe it would be better to name it something like: click <x> pixels right and <y> pixels below <place>? That's not quite right either, but....
Can you try to write the documentation for the new commands?

Copy link
Owner

@fhoeben fhoeben left a 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) {
Copy link
Owner

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);
Copy link
Owner

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();
Copy link
Owner

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 @@
---
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I appreciate the test!

Copy link
Contributor Author

@teunisnl teunisnl Jul 11, 2017

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.

@teunisnl
Copy link
Contributor Author

teunisnl commented Jun 2, 2017

Added the documentation

on technical part, well getActions() is public now so i can always move this to an extended version

@@ -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) |
Copy link
Owner

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants