Skip to content
This repository was archived by the owner on Feb 2, 2025. It is now read-only.

Commit 6160afc

Browse files
committed
Fixes #88
Added commong-lang3 explicitly as dependency Refactoring of array handling Using StringUtils instead of custom Python join
1 parent 4a911cb commit 6160afc

File tree

13 files changed

+387
-351
lines changed

13 files changed

+387
-351
lines changed

pom.xml

+5
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@
145145
<artifactId>webdrivermanager</artifactId>
146146
<version>3.4.0</version>
147147
</dependency>
148+
<dependency>
149+
<groupId>org.apache.commons</groupId>
150+
<artifactId>commons-lang3</artifactId>
151+
<version>3.9</version>
152+
</dependency>
148153
</dependencies>
149154

150155
<build>

src/main/java/com/github/markusbernhardt/seleniumlibrary/keywords/BrowserManagement.java

+115-115
Large diffs are not rendered by default.

src/main/java/com/github/markusbernhardt/seleniumlibrary/keywords/Element.java

+36-36
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ protected void pageShouldContainElement(String locator, String tag, String messa
200200
}
201201
}
202202

203-
@RobotKeyword("Verify the element identified by ``locator`` is not found on the current page\r\n" +
204-
"\r\n" +
203+
@RobotKeyword("Verify the element identified by ``locator`` is not found on the current page\r\n" +
204+
"\r\n" +
205205
"Key attributes for arbitrary elements are id and name. See `Introduction` for details about log levels and locators.")
206206
@ArgumentNames({ "locator", "message=NONE", "logLevel=INFO" })
207207
public void pageShouldNotContainElement(String locator, String...params) {
@@ -254,7 +254,7 @@ public void elementShouldBeEnabled(String locator) {
254254
}
255255

256256
@RobotKeyword("Verify the element identified by ``locator`` is disabled.\r\n" +
257-
"\r\n" +
257+
"\r\n" +
258258
"Key attributes for arbitrary elements are id and name. See `Introduction` for details about locators.")
259259
@ArgumentNames({ "locator" })
260260
public void elementShouldBeDisabled(String locator) {
@@ -274,7 +274,7 @@ public void elementShouldBeFocused(String locator) {
274274
}
275275

276276
@RobotKeyword("Verify the element identified by ``locator`` is selected.\r\n" +
277-
"\r\n" +
277+
"\r\n" +
278278
"Key attributes for arbitrary elements are id and name. See `Introduction` for details about locators.")
279279
@ArgumentNames({ "locator", "message=NONE" })
280280
public void elementShouldBeSelected(String locator, String...params) {
@@ -291,7 +291,7 @@ public void elementShouldBeSelected(String locator, String...params) {
291291
}
292292

293293
@RobotKeyword("Verify the element identified by ``locator`` is not selected.\r\n" +
294-
"\r\n" +
294+
"\r\n" +
295295
"Key attributes for arbitrary elements are id and name. See `Introduction` for details about locators.")
296296
@ArgumentNames({ "locator", "message=NONE" })
297297
public void elementShouldNotBeSelected(String locator, String...params) {
@@ -326,10 +326,10 @@ public void elementShouldBeVisible(String locator, String...params) {
326326
}
327327
}
328328

329-
@RobotKeyword("Verify the element identified by ``locator`` is not visible.\r\n" +
330-
"\r\n" +
331-
"Herein, visible means that the element is logically visible, not optically visible in the current browser viewport. For example, an element that carries display:none is not logically visible, so using this keyword on that element would fail.\r\n" +
332-
"\r\n" +
329+
@RobotKeyword("Verify the element identified by ``locator`` is not visible.\r\n" +
330+
"\r\n" +
331+
"Herein, visible means that the element is logically visible, not optically visible in the current browser viewport. For example, an element that carries display:none is not logically visible, so using this keyword on that element would fail.\r\n" +
332+
"\r\n" +
333333
"Key attributes for arbitrary elements are id and name. See `Introduction` for details about locators.")
334334
@ArgumentNames({ "locator", "message=NONE" })
335335
public void elementShouldNotBeVisible(String locator, String...params) {
@@ -345,8 +345,8 @@ public void elementShouldNotBeVisible(String locator, String...params) {
345345
}
346346
}
347347

348-
@RobotKeyword("Verify the element identified by ``locator`` is clickable.\r\n" +
349-
"\r\n" +
348+
@RobotKeyword("Verify the element identified by ``locator`` is clickable.\r\n" +
349+
"\r\n" +
350350
"Key attributes for arbitrary elements are id and name. See `Introduction` for details about locators.")
351351
@ArgumentNames({ "locator", "message=NONE" })
352352
public void elementShouldBeClickable(String locator, String...params) {
@@ -362,8 +362,8 @@ public void elementShouldBeClickable(String locator, String...params) {
362362
}
363363
}
364364

365-
@RobotKeyword("Verify the element identified by ``locator`` is not clickable.\r\n" +
366-
"\r\n" +
365+
@RobotKeyword("Verify the element identified by ``locator`` is not clickable.\r\n" +
366+
"\r\n" +
367367
"Key attributes for arbitrary elements are id and name. See `Introduction` for details about locators.")
368368
@ArgumentNames({ "locator", "message=NONE" })
369369
public void elementShouldNotBeClickable(String locator, String...params) {
@@ -399,10 +399,10 @@ public void elementTextShouldBe(String locator, String text, String...params) {
399399
}
400400
}
401401

402-
@RobotKeyword("Verify the text of the element identified by ``locator`` is not exactly ``text``.\r\n" +
403-
"\r\n" +
404-
"In contrast to `Element Should Not Contain`, this keyword does not try a substring match but an exact match on the element identified by locator.\r\n" +
405-
"\r\n" +
402+
@RobotKeyword("Verify the text of the element identified by ``locator`` is not exactly ``text``.\r\n" +
403+
"\r\n" +
404+
"In contrast to `Element Should Not Contain`, this keyword does not try a substring match but an exact match on the element identified by locator.\r\n" +
405+
"\r\n" +
406406
"Key attributes for arbitrary elements are id and name. See `Introduction` for details about locators.")
407407
@ArgumentNames({ "locator", "text", "message=NONE", "ignore_case=False" })
408408
public void elementTextShouldNotBe(String locator, String text, String...params) {
@@ -510,8 +510,8 @@ public int getHorizontalPosition(String locator) {
510510
return elements.get(0).getLocation().getX();
511511
}
512512

513-
@RobotKeyword("Returns the value attribute of the element identified by ``locator``..\r\n" +
514-
"\r\n" +
513+
@RobotKeyword("Returns the value attribute of the element identified by ``locator``..\r\n" +
514+
"\r\n" +
515515
"Key attributes for arbitrary elements are id and name. See `Introduction` for details about locators.")
516516
@ArgumentNames({ "locator" })
517517
public String getValue(String locator) {
@@ -528,8 +528,8 @@ protected String getValue(String locator, String tag) {
528528
return elements.get(0).getAttribute("value");
529529
}
530530

531-
@RobotKeyword("Returns the text of the element identified by ``locator``..\r\n" +
532-
"\r\n" +
531+
@RobotKeyword("Returns the text of the element identified by ``locator``..\r\n" +
532+
"\r\n" +
533533
"Key attributes for arbitrary elements are id and name. See `Introduction` for details about locators.")
534534
@ArgumentNames({ "locator" })
535535
public String getText(String locator) {
@@ -542,10 +542,10 @@ public String getText(String locator) {
542542
return elements.get(0).getText();
543543
}
544544

545-
@RobotKeyword("Returns vertical position of element identified by ``locator``.\r\n" +
546-
"\r\n" +
547-
"The position is returned in pixels off the left side of the page, as an integer. Fails if the matching element is not found.\r\n" +
548-
"\r\n" +
545+
@RobotKeyword("Returns vertical position of element identified by ``locator``.\r\n" +
546+
"\r\n" +
547+
"The position is returned in pixels off the left side of the page, as an integer. Fails if the matching element is not found.\r\n" +
548+
"\r\n" +
549549
"Key attributes for arbitrary elements are id and name. See `Introduction` for details about locators.")
550550
@ArgumentNames({ "locator" })
551551
public int getVerticalPosition(String locator) {
@@ -563,8 +563,8 @@ public int getVerticalPosition(String locator) {
563563
// Keywords - Mouse Input/Events
564564
// ##############################
565565

566-
@RobotKeyword("Click on the element identified by ``locator``.\r\n" +
567-
"\r\n" +
566+
@RobotKeyword("Click on the element identified by ``locator``.\r\n" +
567+
"\r\n" +
568568
"Key attributes for arbitrary elements are id and name. See `Introduction` for details about locators.")
569569
@ArgumentNames({ "locator" })
570570
public void clickElement(String locator) {
@@ -574,10 +574,10 @@ public void clickElement(String locator) {
574574
elements.get(0).click();
575575
}
576576

577-
@RobotKeyword("Click on the element identified by locator at the coordinates ``xOffset`` and ``yOffset``.\r\n" +
578-
"\r\n" +
579-
"The cursor is moved at the center of the element and the to the given x/y offset from that point. Both offsets are specified as negative (left/up) or positive (right/down) number.\r\n" +
580-
"\r\n" +
577+
@RobotKeyword("Click on the element identified by locator at the coordinates ``xOffset`` and ``yOffset``.\r\n" +
578+
"\r\n" +
579+
"The cursor is moved at the center of the element and the to the given x/y offset from that point. Both offsets are specified as negative (left/up) or positive (right/down) number.\r\n" +
580+
"\r\n" +
581581
"Key attributes for arbitrary elements are id and name. See `Introduction` for details about locators.")
582582
@ArgumentNames({ "locator", "xOffset", "yOffset" })
583583
public void clickElementAtCoordinates(String locator, String xOffset, String yOffset) {
@@ -589,8 +589,8 @@ public void clickElementAtCoordinates(String locator, String xOffset, String yOf
589589
action.moveToElement(element).moveByOffset(Integer.parseInt(xOffset), Integer.parseInt(yOffset)).perform();
590590
}
591591

592-
@RobotKeyword("Double-Click on the element identified by ``locator``.\r\n" +
593-
"\r\n" +
592+
@RobotKeyword("Double-Click on the element identified by ``locator``.\r\n" +
593+
"\r\n" +
594594
"Key attributes for arbitrary elements are id and name. See `Introduction` for details about locators.")
595595
@ArgumentNames({ "locator" })
596596
public void doubleClickElement(String locator) {
@@ -670,8 +670,8 @@ public void mouseDown(String locator) {
670670
action.clickAndHold(elements.get(0)).perform();
671671
}
672672

673-
@RobotKeyword("Simulates moving the mouse away from the element identified by ``locator``.\r\n" +
674-
"\r\n" +
673+
@RobotKeyword("Simulates moving the mouse away from the element identified by ``locator``.\r\n" +
674+
"\r\n" +
675675
"Key attributes for arbitrary elements are id and name. See `Introduction` for details about locators.")
676676
@ArgumentNames({ "locator" })
677677
public void mouseOut(String locator) {
@@ -1127,7 +1127,7 @@ protected CharSequence mapAsciiKeyCodeToKey(int keyCode) {
11271127
public static String escapeXpathValue(String value) {
11281128
if (value.contains("\"") && value.contains("'")) {
11291129
String[] partsWoApos = value.split("'");
1130-
return String.format("concat('%s')", Python.join("', \"'\", '", Arrays.asList(partsWoApos)));
1130+
return String.format("concat('%s')", StringUtils.join(partsWoApos, "', \"'\", '"));
11311131
}
11321132
if (value.contains("'")) {
11331133
return String.format("\"%s\"", value);

0 commit comments

Comments
 (0)