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

Commit 471a26f

Browse files
authored
Merge pull request #63 from Hi-Fi/release/3.14.0.0
Release/3.14.0.0
2 parents 2f52fd7 + 3951c18 commit 471a26f

File tree

15 files changed

+135
-90
lines changed

15 files changed

+135
-90
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,18 @@ your pom.xml:
4545
<dependency>
4646
<groupId>com.github.hi-fi</groupId>
4747
<artifactId>robotframework-seleniumlibrary</artifactId>
48-
<version>3.12.0.1</version>
48+
<version>3.14.0.0</version>
4949
<scope>test</scope>
5050
</dependency>
5151

5252
If you cannot use the robotframework-maven-plugin you can use the
53-
[jar-with-dependencies](http://central.maven.org/maven2/com/github/hi-fi/robotframework-seleniumlibrary/3.12.0.1/robotframework-seleniumlibrary-3.12.0.1-jar-with-dependencies.jar),
53+
[jar-with-dependencies](http://central.maven.org/maven2/com/github/hi-fi/robotframework-seleniumlibrary/3.14.0.0/robotframework-seleniumlibrary-3.14.0.0-jar-with-dependencies.jar),
5454
which contains all required libraries.
5555

5656
* More information about this library can be found in the
57-
[Keyword Documentation](http://central.maven.org/maven2/com/github/hi-fi/robotframework-seleniumlibrary/3.12.0.1/robotframework-seleniumlibrary-3.12.0.1.html).
57+
[Keyword Documentation](http://central.maven.org/maven2/com/github/hi-fi/robotframework-seleniumlibrary/3.14.0.0/robotframework-seleniumlibrary-3.14.0.0.html).
5858
* For keyword completion in RIDE you can download this
59-
[Library Specs](http://central.maven.org/maven2/com/github/hi-fi/robotframework-seleniumlibrary/3.12.0.1/robotframework-seleniumlibrary-3.12.0.1.xml)
59+
[Library Specs](http://central.maven.org/maven2/com/github/hi-fi/robotframework-seleniumlibrary/3.14.0.0/robotframework-seleniumlibrary-3.14.0.0.xml)
6060
and place it in your PYTHONPATH.
6161

6262
Differences

pom.xml

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>com.github.hi-fi</groupId>
66
<artifactId>robotframework-seleniumlibrary</artifactId>
7-
<version>3.12.0.2-SNAPSHOT</version>
7+
<version>3.14.0.1-SNAPSHOT</version>
88
<packaging>jar</packaging>
99

1010
<name>Robot Framework :: SeleniumLibrary</name>
@@ -70,7 +70,7 @@
7070
<java.version>1.7</java.version>
7171
<robotframework.version>3.0.4</robotframework.version>
7272
<robotframework.maven.plugin.version>1.4.7</robotframework.maven.plugin.version>
73-
<selenium.version>3.12.0</selenium.version>
73+
<selenium.version>3.14.0</selenium.version>
7474
<keywords.class>SeleniumLibrary</keywords.class>
7575
<browser>jbrowser</browser>
7676
</properties>
@@ -154,7 +154,7 @@
154154
<dependency>
155155
<groupId>com.machinepublishers</groupId>
156156
<artifactId>jbrowserdriver</artifactId>
157-
<version>1.0.0-RC1</version>
157+
<version>1.0.0</version>
158158
</dependency>
159159
<dependency>
160160
<groupId>org.mockito</groupId>
@@ -260,7 +260,7 @@
260260
<goal>run</goal>
261261
</goals>
262262
<configuration>
263-
<logLevel>debug</logLevel>
263+
<logLevel>TRACE:INFO</logLevel>
264264
<testCasesDirectory>${project.basedir}/src/test/robotframework/testsuites</testCasesDirectory>
265265
<variables>
266266
<variable>browser:${browser}</variable>
@@ -272,13 +272,6 @@
272272
<nonCriticalTags>
273273
<nonCriticalTag>${browser}</nonCriticalTag>
274274
</nonCriticalTags>
275-
<externalRunner>
276-
<jvmArgs>
277-
<jvmArg>-Dphantomjs.binary.path=${phantomjs.binary.path}</jvmArg>
278-
<jvmArg>-Dwebdriver.gecko.driver=${webdriver.gecko.driver}</jvmArg>
279-
<jvmArg>-Dwebdriver.chrome.driver=${webdriver.chrome.driver}</jvmArg>
280-
</jvmArgs>
281-
</externalRunner>
282275
</configuration>
283276
</execution>
284277
<execution>
@@ -418,6 +411,13 @@
418411
<plugin>
419412
<groupId>org.robotframework</groupId>
420413
<artifactId>robotframework-maven-plugin</artifactId>
414+
<configuration>
415+
<externalRunner>
416+
<jvmArgs>
417+
<jvmArg>-Dwebdriver.gecko.driver=${webdriver.gecko.driver}</jvmArg>
418+
</jvmArgs>
419+
</externalRunner>
420+
</configuration>
421421
</plugin>
422422
</plugins>
423423
</build>
@@ -436,6 +436,13 @@
436436
<plugin>
437437
<groupId>org.robotframework</groupId>
438438
<artifactId>robotframework-maven-plugin</artifactId>
439+
<configuration>
440+
<externalRunner>
441+
<jvmArgs>
442+
<jvmArg>-Dwebdriver.gecko.driver=${webdriver.gecko.driver}</jvmArg>
443+
</jvmArgs>
444+
</externalRunner>
445+
</configuration>
439446
</plugin>
440447
</plugins>
441448
</build>
@@ -454,6 +461,13 @@
454461
<plugin>
455462
<groupId>org.robotframework</groupId>
456463
<artifactId>robotframework-maven-plugin</artifactId>
464+
<configuration>
465+
<externalRunner>
466+
<jvmArgs>
467+
<jvmArg>-Dphantomjs.binary.path=${phantomjs.binary.path}</jvmArg>
468+
</jvmArgs>
469+
</externalRunner>
470+
</configuration>
457471
</plugin>
458472
</plugins>
459473
</build>
@@ -472,6 +486,13 @@
472486
<plugin>
473487
<groupId>org.robotframework</groupId>
474488
<artifactId>robotframework-maven-plugin</artifactId>
489+
<configuration>
490+
<externalRunner>
491+
<jvmArgs>
492+
<jvmArg>-Dwebdriver.chrome.driver=${webdriver.chrome.driver}</jvmArg>
493+
</jvmArgs>
494+
</externalRunner>
495+
</configuration>
475496
</plugin>
476497
</plugins>
477498
</build>
@@ -490,6 +511,13 @@
490511
<plugin>
491512
<groupId>org.robotframework</groupId>
492513
<artifactId>robotframework-maven-plugin</artifactId>
514+
<configuration>
515+
<externalRunner>
516+
<jvmArgs>
517+
<jvmArg>-Dwebdriver.chrome.driver=${webdriver.chrome.driver}</jvmArg>
518+
</jvmArgs>
519+
</externalRunner>
520+
</configuration>
493521
</plugin>
494522
</plugins>
495523
</build>

src/main/java/com/github/markusbernhardt/seleniumlibrary/SeleniumLibrary.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -116,16 +116,16 @@ public String getKeywordDocumentation(String keywordName) {
116116
"Supported strategies are:\r\n" +
117117
"\r\n" +
118118
" | = Strategy = | = Example = | = Description = | \r\n" +
119-
" | identifier | Click Element | identifier=my_element | Matches by @id or @name attribute | \r\n" +
120-
" | id | Click Element | id=my_element | Matches by @id attribute | \r\n" +
121-
" | name | Click Element | name=my_element | Matches by @name attribute | \r\n" +
122-
" | xpath | Click Element | xpath=//div[@id='my_element'] | Matches by arbitrary XPath expression | \r\n" +
123-
" | dom | Click Element | dom=document.images[56] | Matches by arbitrary DOM expression | \r\n" +
124-
" | link | Click Element | link=My Link | Matches by the link text | \r\n" +
125-
" | css | Click Element | css=div.my_class | Matches by CSS selector | \r\n" +
126-
" | jquery | Click Element | jquery=div.my_class | Matches by jQuery/sizzle selector | \r\n" +
127-
" | sizzle | Click Element | sizzle=div.my_class | Matches by jQuery/sizzle selector | \r\n" +
128-
" | tag | Click Element | tag=div | Matches by HTML tag name | \r\n" +
119+
" | identifier | Click Element | identifier:my_element | Matches by @id or @name attribute | \r\n" +
120+
" | id | Click Element | id:my_element | Matches by @id attribute | \r\n" +
121+
" | name | Click Element | name:my_element | Matches by @name attribute | \r\n" +
122+
" | xpath | Click Element | xpath://div[@id='my_element'] | Matches by arbitrary XPath expression | \r\n" +
123+
" | dom | Click Element | dom:document.images[56] | Matches by arbitrary DOM expression | \r\n" +
124+
" | link | Click Element | link:My Link | Matches by the link text | \r\n" +
125+
" | css | Click Element | css:div.my_class | Matches by CSS selector | \r\n" +
126+
" | jquery | Click Element | jquery:div.my_class | Matches by jQuery/sizzle selector | \r\n" +
127+
" | sizzle | Click Element | sizzle:div.my_class | Matches by jQuery/sizzle selector | \r\n" +
128+
" | tag | Click Element | tag:div | Matches by HTML tag name | \r\n" +
129129
" \r\n" +
130130
"== Locating tables ==\r\n" +
131131
"\r\n" +
@@ -138,8 +138,8 @@ public String getKeywordDocumentation(String keywordName) {
138138
"More complex table locator strategies:\r\n" +
139139
"\r\n" +
140140
" | = Strategy = | = Example = | = Description = | \r\n" +
141-
" | xpath | Table Should Contain | xpath=//table/[@name=\"my_table\"] | text | Matches by arbitrary XPath expression | \r\n" +
142-
" | css | Table Should Contain | css=table.my_class | text | Matches by CSS selector | \r\n" +
141+
" | xpath | Table Should Contain | xpath://table/[@name=\"my_table\"] | text | Matches by arbitrary XPath expression | \r\n" +
142+
" | css | Table Should Contain | css:table.my_class | text | Matches by CSS selector | \r\n" +
143143
"\r\n" +
144144
"== Custom location strategies ==\r\n" +
145145
"\r\n" +

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,11 @@ public void addLocationStrategy(String strategyName, String functionDefinition)
139139
"\r\n" +
140140
"Example:\r\n" +
141141
" | Add Location Strategy | byId | return window.document.getElementById(arguments[0]); | \r\n" +
142-
" | Input Text | byId=firstName | Max |\r\n" +
142+
" | Input Text | byId:firstName | Max |\r\n" +
143143
"\r\n" +
144144
"Example with delimiter:\r\n" +
145145
" | Add Location Strategy | byClassname | return window.document.getElementsByClassName(arguments[0])[arguments[1]]; | , | \r\n" +
146-
" | Input Text | byClassname=input,3 | Max | ")
146+
" | Input Text | byClassname:input,3 | Max | ")
147147
@ArgumentNames({ "strategyName", "functionDefinition", "delimiter=NONE" })
148148
public void addLocationStrategy(String strategyName, String functionDefinition, String delimiter) {
149149
ElementFinder.addLocationStrategy(strategyName, functionDefinition, delimiter);
@@ -660,12 +660,15 @@ protected WebDriver createLocalWebDriver(String browserName, Capabilities desire
660660
case "opera":
661661
return new OperaDriver(new OperaOptions().merge(desiredCapabilities));
662662
case "phantomjs":
663+
logging.warn("Phantomjs going to be removed as it's development is suspended. Should move to some other browser" );
663664
return new PhantomJSDriver(desiredCapabilities);
664665
case "safari":
665666
return new SafariDriver(new SafariOptions().merge(desiredCapabilities));
666667
case "htmlunit":
668+
logging.warn("HTMLUnit-driver going to be removed from Selenium. Should move to some other browser" );
667669
return new HtmlUnitDriver(desiredCapabilities);
668670
case "htmlunitwithjs":
671+
logging.warn("HTMLUnit-driver going to be removed from Selenium. Should move to some other browser" );
669672
HtmlUnitDriver driver = new HtmlUnitDriver(desiredCapabilities);
670673
driver.setJavascriptEnabled(true);
671674
return driver;
@@ -736,13 +739,15 @@ protected Capabilities createCapabilities(String browserName, String desiredCapa
736739
desiredCapabilities = new OperaOptions();
737740
break;
738741
case "phantomjs":
742+
logging.warn("Phantomjs going to be removed as it's development is suspended. Should move to some other browser" );
739743
desiredCapabilities = DesiredCapabilities.phantomjs();
740744
break;
741745
case "safari":
742746
desiredCapabilities = new SafariOptions();
743747
break;
744748
case "htmlunit":
745749
case "htmlunitwithjs":
750+
logging.warn("HTMLUnit-driver going to be removed from Selenium. Should move to some other browser" );
746751
desiredCapabilities = DesiredCapabilities.htmlUnit();
747752
((DesiredCapabilities) desiredCapabilities).setBrowserName("htmlunit");
748753
break;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ protected void pageShouldNotContainElement(String locator, String tag, String me
230230
"This is mainly useful, when the locator is a complicated and slow XPath expression. The identifier expires when the page is reloaded.\r\n" +
231231
"\r\n" +
232232
"Example:\r\n" +
233-
" | Assign ID to Element | xpath=//div[@id=\\\"first_div\\\"] | my id | \r\n" +
233+
" | Assign ID to Element | xpath://div[@id=\\\"first_div\\\"] | my id | \r\n" +
234234
" | Page Should Contain Element | my id |")
235235
@ArgumentNames({ "locator", "id" })
236236
public void assignIdToElement(String locator, String id) {

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.github.markusbernhardt.seleniumlibrary.keywords;
22

3+
import org.apache.commons.lang3.exception.ExceptionUtils;
34
import org.openqa.selenium.JavascriptExecutor;
45
import org.robotframework.javalib.annotation.ArgumentNames;
56
import org.robotframework.javalib.annotation.Autowired;
@@ -26,6 +27,9 @@ public class Waiting extends RunOnFailureKeywordsAdapter {
2627
@Autowired
2728
protected Element element;
2829

30+
@Autowired
31+
protected Logging logging;
32+
2933
@Autowired
3034
protected Robot robot;
3135

@@ -411,14 +415,17 @@ protected void waitUntil(String timestr, String message, WaitUntilFunction funct
411415
double timeout = timestr != null ? Robotframework.timestrToSecs(timestr) : browserManagement.getTimeout();
412416
message = message.replace("<TIMEOUT>", Robotframework.secsToTimestr(timeout));
413417
long maxtime = System.currentTimeMillis() + (long) (timeout * 1000);
418+
Throwable exception = new Throwable();
414419
for (;;) {
415420
try {
416421
if (function.isFinished()) {
417422
break;
418423
}
419424
} catch (Throwable t) {
425+
exception = t;
420426
}
421427
if (System.currentTimeMillis() > maxtime) {
428+
logging.trace(ExceptionUtils.getStackTrace(exception));
422429
throw new SeleniumLibraryNonFatalException(message);
423430
}
424431
try {

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ public class Window extends RunOnFailureKeywordsAdapter {
3838
" | Title Should Be | Popup Title | | \r\n" +
3939
" | Select Window | | # Chooses the main window again |\r\n" +
4040
"\r\n" +
41-
"It is also possible to specify the approach Selenium2Library should take to find a window by specifying a locator strategy. See Introduction for details about locators:\r\n" +
41+
"It is also possible to specify the approach SeleniumLibrary should take to find a window by specifying a locator strategy. See Introduction for details about locators:\r\n" +
4242
"\r\n" +
4343
" | = Strategy = | = Example = | = Description = | \r\n" +
44-
" | title | Select Window | title=My Document | Matches by window title | \r\n" +
45-
" | name | Select Window | name=${name} | Matches by window javascript name | \r\n" +
46-
" | url | Select Window | url=http://google.com | Matches by window's current URL |")
44+
" | title | Select Window | title:My Document | Matches by window title | \r\n" +
45+
" | name | Select Window | name:${name} | Matches by window javascript name | \r\n" +
46+
" | url | Select Window | url:http://google.com | Matches by window's current URL |")
4747
@ArgumentNames({ "locator=MAIN" })
4848
public void selectWindow(String locator) {
4949
WindowManager.select(browserManagement.getWebDriverCache().getCurrent(), locator);

src/main/java/com/github/markusbernhardt/seleniumlibrary/locators/ElementFinder.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@
1313
import org.openqa.selenium.WebDriver;
1414
import org.openqa.selenium.WebElement;
1515
import org.python.util.PythonInterpreter;
16+
import org.robotframework.javalib.annotation.Autowired;
1617

1718
import com.github.markusbernhardt.seleniumlibrary.SeleniumLibraryNonFatalException;
1819
import com.github.markusbernhardt.seleniumlibrary.keywords.Element;
20+
import com.github.markusbernhardt.seleniumlibrary.keywords.Logging;
1921
import com.github.markusbernhardt.seleniumlibrary.utils.Python;
2022

2123
public class ElementFinder {
@@ -275,8 +277,11 @@ protected static Strategy parseLocator(FindByCoordinates findByCoordinates, Stri
275277
String prefix = null;
276278
String criteria = locator;
277279
if (!locator.startsWith("//")) {
278-
String[] locatorParts = locator.split("=", 2);
280+
String[] locatorParts = locator.split("[=:]", 2);
279281
if (locatorParts.length == 2) {
282+
if (locator.charAt(locatorParts[0].length()) == "=".charAt(0)) {
283+
System.out.println("*WARN* '=' is deprecated as locator strategy separator. ':' should be used instead" );
284+
}
280285
prefix = locatorParts[0].trim().toUpperCase();
281286
criteria = locatorParts[1].trim();
282287
}

0 commit comments

Comments
 (0)