-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Selenium: Add most common methods to the "SeleniumWebDriverHelper" #8746
Selenium: Add most common methods to the "SeleniumWebDriverHelper" #8746
Conversation
…d-methods-SeleniumWebDriverHelper
* @param timeout waiting time in seconds | ||
* @return found element | ||
*/ | ||
public WebElement waitElementIsPresentInDom(By elementLocator, int timeout) { |
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.
waitElementIsPresentInDom
> 'waitElementIsPresented'
* @param elementLocator | ||
* @return found element | ||
*/ | ||
public WebElement waitElementIsPresentInDom(By elementLocator) { |
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.
* @param webElement | ||
* @return element text by {@link WebElement#getText()} | ||
*/ | ||
public String getFieldText(WebElement webElement) { |
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.
waitElementText
describes the propose of method much better, IMHO
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.
Sorry but I am not agree, this method waits for visibility of webelement and get text from it. It does not wait for a particular text.
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.
waitVisibilityAndGetText
* @param fieldLocator | ||
* @return element text by {@link WebElement#getText()} | ||
*/ | ||
public String getFieldText(By fieldLocator) { |
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.
* @param expectedValue | ||
* @param timeout waiting time in seconds | ||
*/ | ||
public void waitFieldValue(By fieldLocator, String expectedValue, int timeout) { |
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.
Let's replace Field
on Element
to make method more general.
* | ||
* @param fieldLocator | ||
* @param expectedValue | ||
*/ | ||
public void waitFieldValue(By fieldLocator, String expectedValue) { |
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.
* @param expectedValue | ||
* @param timeout waiting time in seconds | ||
*/ | ||
public void waitFieldValue(WebElement webElement, String expectedValue, int timeout) { |
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.
* @param webElement | ||
* @param expectedValue | ||
*/ | ||
public void waitFieldValue(WebElement webElement, String expectedValue) { |
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.
* @param expectedText | ||
* @param timeout waiting time in seconds | ||
*/ | ||
public void waitFieldText(By fieldLocator, String expectedText, int timeout) { |
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.
* @param fieldLocator | ||
* @param expectedText | ||
*/ | ||
public void waitFieldText(By fieldLocator, String expectedText) { |
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.
* @param webElement | ||
* @param expectedText | ||
*/ | ||
public void waitFieldText(WebElement webElement, String expectedText) { |
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.
* | ||
* @param elementLocator | ||
*/ | ||
public void moveToElementAndDoDoubleClick(By elementLocator) { |
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.
moveToElementAndDoDoubleClick
> moveCursorToElementAndDoubleClick
|
||
/** | ||
* Moves cursor to {@link WebElement} with provided locator {@link By} and click twice on it by | ||
* {@link org.openqa.selenium.interactions.Action} Used exactly {@link Actions#doubleClick()} and |
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.
Could you, please, fix the java docs?
} | ||
|
||
/** | ||
* Moves cursor to provided {@link WebElement} and click twice on it by {@link |
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.
* | ||
* @param webElement | ||
*/ | ||
public void moveToElementAndDoDoubleClick(WebElement webElement) { |
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.
} | ||
|
||
/** | ||
* Moves cursor to {@link WebElement} with provided locator {@link By} and click once on it by |
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.
click
> clicks
* | ||
* @param elementLocator | ||
*/ | ||
public void moveToElementAndClickOnIt(By elementLocator) { |
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.
moveToElementAndClickOnIt
> moveCursorToElementAndClick
* WebElement#click()} | ||
* | ||
* @param webElement | ||
*/ | ||
public void waitAndClickOnElement(WebElement webElement) { |
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.
waitAndClickOnElement
> waitAndClick
* @param webElement | ||
* @param timeout waiting time in seconds | ||
*/ | ||
public void waitAndClickOnElement(WebElement webElement, int timeout) { |
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.
* {@link WebElement#click()} | ||
* | ||
* @param elementLocator | ||
*/ | ||
public void waitAndClickOnElement(By elementLocator) { |
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.
* @param elementLocator | ||
* @param timeout waiting time in seconds | ||
*/ | ||
public void waitAndClickOnElement(By elementLocator, int timeout) { |
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.
* | ||
* @param webElement | ||
*/ | ||
public void moveToElementAndClickOnIt(WebElement webElement) { |
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.
* | ||
* @param elementLocator {@link By} | ||
*/ | ||
public void moveToElemet(By elementLocator) { |
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.
moveToElemet
> moveCursorToElement
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.
hoverToElement
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 would prefer moveCursorToElement
so as it uses action#moveTo()
method internally.
* | ||
* @param webElement | ||
*/ | ||
public void moveToElemet(WebElement webElement) { |
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.
* | ||
* @param locator | ||
* @return state of element visibility | ||
*/ | ||
public boolean elementIsVisible(By locator) { |
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.
elementIsVisible
> isElementVisible
* @param webElement | ||
* @return state of element visibility | ||
*/ | ||
public boolean elementIsVisible(WebElement webElement) { |
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.
} | ||
|
||
/** | ||
* Set text in provided field with checks | ||
* Set text in provided field with checks which get text for compare by {@link | ||
* WebElement#getAttribute(String)} | ||
* | ||
* @param webElement | ||
* @param value | ||
*/ | ||
public void setFieldValue(WebElement webElement, String value) { |
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.
How about renaming setFieldValue
> setElementValue
?
} | ||
|
||
/** | ||
* Set text in provided field with checks | ||
* Set text in provided field with checks which get text for compare by {@link |
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.
Let's rewrite java docs to reflect steps which method is executing.
} | ||
|
||
/** | ||
* Set text in provided field with checks | ||
* Set text in provided field with checks which get text for compare by {@link |
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.
@@ -45,55 +45,59 @@ protected SeleniumWebDriverHelper( | |||
} | |||
|
|||
/** | |||
* Set text in provided field with checks | |||
* Set text in provided field with checks which get text for compare by {@link |
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.
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.
propose the next docs:
Ensures {@code element} has got {@code value} in next steps: ensures element is visible and has empty value, sets {@code value} by sending corresponding keys to {@code element}, and waits until element has got the {@code value}.
@@ -469,7 +473,7 @@ public boolean isElementVisible(By locator) { | |||
* @param webElement | |||
* @return state of element visibility | |||
*/ | |||
public boolean isElementVisible(WebElement webElement) { | |||
public boolean isVisible(WebElement webElement) { |
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.
Looks like the method is waiting on element visibility with timeout ATTACHING_ELEM_TO_DOM_SEC.
Let's reflect it in method name and java docs.
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.
How about isVisibileDuringTimeout
name?
* @return state of element visibility | ||
*/ | ||
public boolean isElementVisible(By locator) { | ||
public boolean isVisible(By elementLocator) { |
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.
Looks like the method is waiting on element visibility with timeout ATTACHING_ELEM_TO_DOM_SEC.
Let's reflect it in method name and java docs.
…d-methods-SeleniumWebDriverHelper
…pdatemaster to master updated to 6.1.0 stable, new keycloak theme * commit 'e58465aaeea236ff051b8176af4581a443c0fd88': (115 commits) fixed fonts and added google fonts fallback added box shadow fix added lato regular as bold added lato light italic updated license header added Lato Light to fonts, removed CHE from login page ST-3764, ST-3613 Create keycloak docker image, and use the latest login theme Remove commented Updated version to 6.1.0 tag [maven-release-plugin] prepare release 6.1.0 RELEASE: Update dependencies versions RELEASE: Update parent pom version RELEASE: Set tags in Dockerfiles CHE-8747. Fix displaying pull request panel (eclipse-che#8760) Add different style for focusable element (eclipse-che#8757) Selenium: Add most common methods to the "SeleniumWebDriverHelper" (eclipse-che#8746) Selenium: increase timeout to check that a menu item is enabled (eclipse-che#8755) Support enter press in refactoring rename form (eclipse-che#8754) Selenium: change a way for selecting an element from suggestions list (eclipse-che#8736) CHE-7278 Properly handle restarting the workspace (eclipse-che#8612) ...
What does this PR do?
Add most common methods to the "SeleniumWebDriverHelper"
What issues does this PR fix or reference?
Issue: #8724
Release Notes
Docs PR