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

Commit d81c556

Browse files
author
Juho Saarinen
committed
Merge remote-tracking branch 'upstream/master'
2 parents bd7038d + 7d57f2f commit d81c556

File tree

13 files changed

+232
-84
lines changed

13 files changed

+232
-84
lines changed

CHANGES.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
11
CHANGES
22
=======
33

4+
Working on
5+
----------
6+
* Fixed 'Unable to open firefox when passing in desiredCapabilities and browserOptions arguments'. See #66, #75, #76.
7+
48
Unreleased
59
----------
6-
* Updating xml-doclet to version 1.0.5
10+
11+
1.4.0.8
12+
-------
13+
* Updating robotframework to version 2.9.2
714
* Updating selenium-server to version 2.48.2
15+
* Updating xml-doclet to version 1.0.5
816
* Updating aspectjrt to version 1.8.7
917
* Updating selendroid-client to version 0.17.0
1018
* Updating java-client to version 3.2.0
19+
* Fixed 'Library not loading with Robot Framework 2.9'. See #72, #73, #74. Thanks to Hi-FI !!!
20+
* Fixed 'Selenium update (v 2.48.2)'. See #65, #77
1121

1222
1.4.0.7
13-
----------
23+
-------
1424
* Avoid NullPointerException in isEnabled method. See #53, #56. Great thanks to atcarmo for this patch.
1525
* Updated selenium-server dependency to 2.43.1. See #58. Great thanks to WojtekKowaluk for this patch.
1626
* Corrected Google Search word

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ It is modeled after (and forked from) the Robot Framework
1111
[SeleniumLibrary](http://code.google.com/p/robotframework-seleniumlibrary/)
1212
library, but re-implemented to use Selenium 2 and WebDriver technologies.
1313
* More information about this library can be found in the
14-
[Keyword Documentation](http://search.maven.org/remotecontent?filepath=com/github/markusbernhardt/robotframework-selenium2library-java/1.4.0.6/robotframework-selenium2library-java-1.4.0.6-libdoc.html).
14+
[Keyword Documentation](http://search.maven.org/remotecontent?filepath=com/github/markusbernhardt/robotframework-selenium2library-java/1.4.0.8/robotframework-selenium2library-java-1.4.0.8-libdoc.html).
1515
* For keyword completion in RIDE you can download this
16-
[Library Specs](http://search.maven.org/remotecontent?filepath=com/github/markusbernhardt/robotframework-selenium2library-java/1.4.0.6/robotframework-selenium2library-java-1.4.0.6-libdoc.xml)
16+
[Library Specs](http://search.maven.org/remotecontent?filepath=com/github/markusbernhardt/robotframework-selenium2library-java/1.4.0.8/robotframework-selenium2library-java-1.4.0.8-libdoc.xml)
1717
and place it in your PYTHONPATH.
1818

1919
This Java port of the existing Selenium2Library was created to enable
@@ -37,16 +37,16 @@ your pom.xml:
3737
<dependency>
3838
<groupId>com.github.markusbernhardt</groupId>
3939
<artifactId>robotframework-selenium2library-java</artifactId>
40-
<version>1.4.0.6</version>
40+
<version>1.4.0.8</version>
4141
<scope>test</scope>
4242
</dependency>
4343

4444
If you cannot use the robotframework-maven-plugin you can use the
45-
[jar-with-dependencies](http://search.maven.org/remotecontent?filepath=com/github/markusbernhardt/robotframework-selenium2library-java/1.4.0.6/robotframework-selenium2library-java-1.4.0.6-jar-with-dependencies.jar),
45+
[jar-with-dependencies](http://search.maven.org/remotecontent?filepath=com/github/markusbernhardt/robotframework-selenium2library-java/1.4.0.8/robotframework-selenium2library-java-1.4.0.8-jar-with-dependencies.jar),
4646
which contains all required libraries.
4747

4848
If you want more control and feel adventurous you could you use this
49-
[jar](http://search.maven.org/remotecontent?filepath=com/github/markusbernhardt/robotframework-selenium2library-java/1.4.0.6/robotframework-selenium2library-java-1.4.0.6.jar)
49+
[jar](http://search.maven.org/remotecontent?filepath=com/github/markusbernhardt/robotframework-selenium2library-java/1.4.0.8/robotframework-selenium2library-java-1.4.0.8.jar)
5050
and provide all required libraries from this [list](DEPENDENCIES.md) on your own.
5151

5252
Differences

pom.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
32
<modelVersion>4.0.0</modelVersion>
43

54
<parent>
@@ -10,7 +9,7 @@
109

1110
<groupId>com.github.markusbernhardt</groupId>
1211
<artifactId>robotframework-selenium2library-java</artifactId>
13-
<version>1.4.0.8-SNAPSHOT</version>
12+
<version>1.4.0.9-SNAPSHOT</version>
1413
<packaging>jar</packaging>
1514

1615
<name>Robot Framework :: Selenium2Library</name>

src/main/java/com/github/markusbernhardt/selenium2library/Selenium2Library.java

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
package com.github.markusbernhardt.selenium2library;
2+
23
import java.io.File;
34
import java.util.ResourceBundle;
45

@@ -32,13 +33,13 @@
3233
* instance and should work with most modern browsers and can be used with the
3334
* Jython interpreter or any other Java application.<br>
3435
* <br>
35-
* <font size="+1"><b>Before running tests</b></font><br>
36+
* <span style="font-size: 120%;"><b>Before running tests</b></span><br>
3637
* Prior to running test cases using Selenium2Library, the library must be
3738
* imported into your Robot Framework test suite (see importing section), and
3839
* the `Open Browser` keyword must be used to open a browser to the desired
3940
* location.<br>
4041
* <br>
41-
* <font size="+1"><b>Locating elements</b></font><br>
42+
* <span style="font-size: 120%;"><b>Locating elements</b></span><br>
4243
* All keywords in Selenium2Library that need to find an element on the page
4344
* take an locator argument.<br>
4445
* <br>
@@ -48,7 +49,7 @@
4849
* <i>name</i> are key attributes to all elements.<br>
4950
* <br>
5051
* List of key attributes:
51-
* <table border="1" cellspacing="0">
52+
* <table border="1" cellspacing="0" summary="">
5253
* <tr>
5354
* <td><b>Element Type</b></td>
5455
* <td><b>Key Attributes</b></td>
@@ -76,7 +77,7 @@
7677
* </table>
7778
* <br>
7879
* Example:
79-
* <table border="1" cellspacing="0">
80+
* <table border="1" cellspacing="0" summary="">
8081
* <tr>
8182
* <td>Click Element</td>
8283
* <td>my_element</td>
@@ -88,7 +89,7 @@
8889
* find an element by specifying a locator strategy with a locator prefix.<br>
8990
* <br>
9091
* Supported strategies are:
91-
* <table border="1" cellspacing="0">
92+
* <table border="1" cellspacing="0" summary="">
9293
* <tr>
9394
* <td><b>Strategy</b></td>
9495
* <td><b>Example</b></td>
@@ -152,7 +153,7 @@
152153
* with the specified id attribute.<br>
153154
* <br>
154155
* Example:<br>
155-
* <table border="1" cellspacing="0">
156+
* <table border="1" cellspacing="0" summary="">
156157
* <tr>
157158
* <td>Table Should Contain</td>
158159
* <td>my_table</td>
@@ -161,16 +162,18 @@
161162
* </table>
162163
* <br>
163164
* More complex table locator strategies:
164-
* <table border="1" cellspacing="0">
165+
* <table border="1" cellspacing="0" summary="">
165166
* <tr>
166167
* <td><b>Strategy</b></td>
167168
* <td><b>Example</b></td>
168169
* <td><b>Description</b></td>
169170
* </tr>
171+
* <tr>
170172
* <td>xpath</td>
171173
* <td>Table Should Contain | xpath=//table/[@name="my_table"] | text</td>
172174
* <td>Matches by arbitrary XPath expression</td>
173175
* </tr>
176+
* <tr>
174177
* <td>css</td>
175178
* <td>Table Should Contain | css=table.my_class | text</td>
176179
* <td>Matches by CSS selector</td>
@@ -182,7 +185,7 @@
182185
* Strategy` for details about custom location strategies.<br>
183186
* <br>
184187
* Example:
185-
* <table border="1" cellspacing="0">
188+
* <table border="1" cellspacing="0" summary="">
186189
* <tr>
187190
* <td>Add Location Strategy</td>
188191
* <td>custom</td>
@@ -195,7 +198,7 @@
195198
* </tr>
196199
* </table>
197200
* <br>
198-
* <font size="+1"><b>Timeouts</b></font><br>
201+
* <span style="font-size: 120%;"><b>Timeouts</b></span><br>
199202
* There are several Wait ... keywords that take <b>timeout</b> as an argument.
200203
* All of these timeout arguments are optional. The timeout used by all of them
201204
* can be set globally using the `Set Selenium Timeout keyword`.<br>
@@ -206,12 +209,12 @@
206209
* "http://robotframework.googlecode.com/svn/trunk/doc/userguide/RobotFrameworkUserGuide.html#time-format"
207210
* >Time Format</a> for details about the time syntax.<br>
208211
* <br>
209-
* <font size="+1"><b>Log Level</b></font><br>
212+
* <span style="font-size: 120%;"><b>Log Level</b></span><br>
210213
* There are several keywords that take <b>timeout</b> as an argument. All of
211214
* these timeout arguments are optional. The default is usually INFO.<br>
212215
* <br>
213216
* List of log levels:
214-
* <table border="1" cellspacing="0">
217+
* <table border="1" cellspacing="0" summary="">
215218
* <tr>
216219
* <td><b>Log Level</b></td>
217220
* <td><b>Description</b></td>
@@ -307,7 +310,7 @@ public Selenium2Library(String timeout, String implicitWait) {
307310
* about this functionality.<br>
308311
* <br>
309312
* Examples:
310-
* <table border="1" cellspacing="0">
313+
* <table border="1" cellspacing="0" summary="">
311314
* <tr>
312315
* <td>Library</td>
313316
* <td>Selenium2Library</td>
@@ -356,7 +359,7 @@ public Selenium2Library(String timeout, String implicitWait) {
356359
* Default=5.0. Optional custom timeout.
357360
* @param implicitWait
358361
* Default=0.0. Optional custom implicit wait time.
359-
* @param runOnFailure
362+
* @param keywordToRunOnFailure
360363
* Default=Capture Page Screenshot. Optional custom keyword to
361364
* run on failure.
362365
*/
@@ -509,6 +512,12 @@ public String getKeywordDocumentation(String keywordName) {
509512
return keywordDocumentation;
510513
}
511514

515+
/**
516+
* Returns the currently active Selenium2Library instance.
517+
*
518+
* @return the library instance
519+
* @throws ScriptException - if error occurs in script
520+
*/
512521
public static Selenium2Library getLibraryInstance() throws ScriptException {
513522
ScriptEngine engine = new ScriptEngineManager().getEngineByName("python");
514523
engine.put("library", "Selenium2Library");
@@ -523,6 +532,10 @@ public static Selenium2Library getLibraryInstance() throws ScriptException {
523532

524533
/**
525534
* Convert all arguments in the object array to string
535+
*
536+
* @param args
537+
* array with object to convert to the return string
538+
* @return the return string
526539
*/
527540
protected Object[] toStrings(Object[] args) {
528541
Object[] newArgs = new Object[args.length];

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

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public void addLocationStrategy(String strategyName, String functionDefinition)
128128
* locator in multiple arguments when executing the JavaScript function. <br>
129129
* <br>
130130
* Example:
131-
* <table border="1" cellspacing="0">
131+
* <table border="1" cellspacing="0" summary="">
132132
* <tr>
133133
* <td>Add Location Strategy</td>
134134
* <td>byId</td>
@@ -142,7 +142,7 @@ public void addLocationStrategy(String strategyName, String functionDefinition)
142142
* </table>
143143
* <br>
144144
* Example with delimiter:
145-
* <table border="1" cellspacing="0">
145+
* <table border="1" cellspacing="0" summary="">
146146
* <tr>
147147
* <td>Add Location Strategy</td>
148148
* <td>byClassname</td>
@@ -215,7 +215,7 @@ public String openBrowser(String url, String browserName, String alias, String r
215215
* Opens a new browser instance to given URL.<br>
216216
* <br>
217217
* Possible values for browser are as follows:
218-
* <table border="1" cellspacing="0">
218+
* <table border="1" cellspacing="0" summary="">
219219
* <tr>
220220
* <td>firefox</td>
221221
* <td>FireFox</td>
@@ -288,14 +288,14 @@ public String openBrowser(String url, String browserName, String alias, String r
288288
* proxy, can be configured.<br>
289289
* <br>
290290
* Example of desiredCapabilities as simple string:<br>
291-
* <table border="1" cellspacing="0">
291+
* <table border="1" cellspacing="0" summary="">
292292
* <tr>
293293
* <td>platform:Windows 8,browserName:firefox,version:25</td>
294294
* </tr>
295295
* </table>
296296
* <br>
297297
* Example of desiredCapabilities as JSON object:<br>
298-
* <table border="1" cellspacing="0">
298+
* <table border="1" cellspacing="0" summary="">
299299
* <tr>
300300
* <td>
301301
* {<br>
@@ -318,7 +318,7 @@ public String openBrowser(String url, String browserName, String alias, String r
318318
* with the listed options are implemented.<br>
319319
* <br>
320320
* Firefox:
321-
* <table border="1" cellspacing="0">
321+
* <table border="1" cellspacing="0" summary="">
322322
* <tr>
323323
* <td>
324324
* {<br>
@@ -355,7 +355,7 @@ public String openBrowser(String url, String browserName, String alias, String r
355355
* instance. The alias can be used later for switching between
356356
* browsers instances, just as returned index.
357357
* @param remoteUrl
358-
* Default=NONE. Optional remote grid URL. When specified no
358+
* Default=False. Optional remote grid URL. When specified no
359359
* local WebDriver instance is created, but a network connection
360360
* to a Selenium 2 WebDriver Grid Hub at the given URL is opened.
361361
* @param desiredCapabilities
@@ -367,14 +367,17 @@ public String openBrowser(String url, String browserName, String alias, String r
367367
* href=
368368
* "http://code.google.com/p/selenium/wiki/DesiredCapabilities"
369369
* >DesiredCapabilities</a>
370+
* @param browserOptions
371+
* Default=NONE. Extended browser options as JSON structure.
370372
* @return The index of the newly created browser instance.
373+
* @throws Throwable - if anything goes wrong
371374
*
372375
* @see BrowserManagement#closeAllBrowsers
373376
* @see BrowserManagement#closeBrowser
374377
* @see BrowserManagement#switchBrowser
375378
*/
376379
@RobotKeyword
377-
@ArgumentNames({ "url", "browserName=firefox", "alias=NONE", "remoteUrl=NONE", "desiredCapabilities=NONE",
380+
@ArgumentNames({ "url", "browserName=firefox", "alias=NONE", "remoteUrl=False", "desiredCapabilities=NONE",
378381
"browserOptions=NONE" })
379382
public String openBrowser(String url, String browserName, String alias, String remoteUrl,
380383
String desiredCapabilities, String browserOptions) throws Throwable {
@@ -412,7 +415,7 @@ public String openBrowser(String url, String browserName, String alias, String r
412415
* it.<br>
413416
* <br>
414417
* Example:
415-
* <table border="1" cellspacing="0">
418+
* <table border="1" cellspacing="0" summary="">
416419
* <tr>
417420
* <td>Open Browser</td>
418421
* <td>http://google.com</td>
@@ -473,7 +476,7 @@ public String openBrowser(String url, String browserName, String alias, String r
473476
* opening the first one because it used index '1' when switching to it
474477
* later. If you aren't sure about that you can store the index into a
475478
* variable as below.
476-
* <table border="1" cellspacing="0">
479+
* <table border="1" cellspacing="0" summary="">
477480
* <tr>
478481
* <td>${id} =</td>
479482
* <td>Open Browser</td>
@@ -589,7 +592,7 @@ public void maximizeBrowserWindow() {
589592
* Returns current window size as <b>width</b> then <b>height</b>.<br>
590593
* <br>
591594
* Example:
592-
* <table border="1" cellspacing="0">
595+
* <table border="1" cellspacing="0" summary="">
593596
* <tr>
594597
* <td>${width}</td>
595598
* <td>${height}=</td>
@@ -599,6 +602,7 @@ public void maximizeBrowserWindow() {
599602
*
600603
* @return The window <b>width</b> and <b>height</b> in px.
601604
*/
605+
@RobotKeyword
602606
public Object[] getWindowSize() {
603607
Dimension size = getCurrentWebDriver().manage().window().getSize();
604608
return new Object[] { Integer.toString(size.width), Integer.toString(size.height) };
@@ -609,7 +613,7 @@ public Object[] getWindowSize() {
609613
* specified values.<br>
610614
* <br>
611615
* Example:
612-
* <table border="1" cellspacing="0">
616+
* <table border="1" cellspacing="0" summary="">
613617
* <tr>
614618
* <td>Set Window Size</td>
615619
* <td>800</td>
@@ -681,7 +685,7 @@ public void selectWindow() {
681685
* The special locator main (default) can be used to select the main window.<br>
682686
* <br>
683687
* Example:
684-
* <table border="1" cellspacing="0">
688+
* <table border="1" cellspacing="0" summary="">
685689
* <tr>
686690
* <td>Click Link</td>
687691
* <td>popup_link</td>
@@ -707,7 +711,7 @@ public void selectWindow() {
707711
* It is also possible to specify the approach Selenium2Library should take
708712
* to find a window by specifying a locator strategy. See `Introduction` for
709713
* details about locators:
710-
* <table border="1" cellspacing="0">
714+
* <table border="1" cellspacing="0" summary="">
711715
* <tr>
712716
* <td><b>Strategy</b></td>
713717
* <td><b>Example</b></td>
@@ -1045,7 +1049,7 @@ public String getSeleniumTimeout() {
10451049
* can be altered in importing the library.<br>
10461050
* <br>
10471051
* Example:
1048-
* <table border="1" cellspacing="0">
1052+
* <table border="1" cellspacing="0" summary="">
10491053
* <tr>
10501054
* <td>${orig timeout} =</td>
10511055
* <td>Set Selenium Timeout</td>
@@ -1104,7 +1108,7 @@ public String getSeleniumImplicitWait() {
11041108
* to be called one time per session.</i><br>
11051109
* <br>
11061110
* Example:
1107-
* <table border="1" cellspacing="0">
1111+
* <table border="1" cellspacing="0" summary="">
11081112
* <tr>
11091113
* <td>${orig wait} =</td>
11101114
* <td>Set Selenium Implicit Wait</td>
@@ -1151,7 +1155,7 @@ public String setSeleniumImplicitWait(String timestr) {
11511155
* to be called one time per session.</i><br>
11521156
* <br>
11531157
* Example:
1154-
* <table border="1" cellspacing="0">
1158+
* <table border="1" cellspacing="0" summary="">
11551159
* <tr>
11561160
* <td>${orig wait} =</td>
11571161
* <td>Set Browser Implicit Wait</td>

0 commit comments

Comments
 (0)