Skip to content

Update fork branch #1

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

Merged
merged 24 commits into from
Jul 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
2ceb292
added webdrivermanager of io.github.bonigarcia library interaction
YauheniPo Jun 29, 2019
b14c678
clickToFirstItem method refactoring
YauheniPo Jun 29, 2019
d7c69cc
added RobotString class for working with system properties and string…
YauheniPo Jun 29, 2019
562d59f
Added SeleniumLibraryNonFatalException to catch block in the CustomRo…
YauheniPo Jun 30, 2019
47c60db
Corrected by review comments - updated constructor issues of CustomRo…
YauheniPo Jul 1, 2019
6b3b3ec
Corrected by review comments - updated constructor issues of CustomRo…
YauheniPo Jul 1, 2019
68e00e1
remover 'static' of getCurrentBrowser method
YauheniPo Jul 1, 2019
36eb5d8
Updated openBrowser method of BrowserManagement class and Robot class…
YauheniPo Jul 2, 2019
fe5b8bb
Corrected by review comments
YauheniPo Jul 4, 2019
5cc545d
Removed RobotString class
YauheniPo Jul 4, 2019
38b2a5d
Updated clickToFirstItem to clickElementByIndex method
YauheniPo Jul 6, 2019
eef989b
Merge pull request #74 from YauheniPo/feature/custom_robot_driver_ele…
Hi-Fi Jul 9, 2019
849b542
Merge pull request #73 from YauheniPo/feature/webdrivermanager
Hi-Fi Jul 9, 2019
7012222
updated the elementShouldContain, elementShouldNotContain, elementTex…
ractoc Jul 15, 2019
637fb35
Merge pull request #76 from ractoc/develop
Hi-Fi Jul 16, 2019
65942af
Replaced Maven plugin for webdriver download with WebdriverManager (t…
Hi-Fi Jul 9, 2019
15e0540
Release 3.141.59.265
Hi-Fi Jul 16, 2019
ae6c18f
Next 3.x version to POM
Hi-Fi Jul 16, 2019
831945f
Merge pull request #77 from Hi-Fi/release/3.141.59.265
Hi-Fi Jul 16, 2019
a3c6650
Added setFocusToElement. This keyword should eventually replace the F…
ractoc Jul 16, 2019
cc61a10
small copy paste error in the error message
ractoc Jul 17, 2019
aaba73b
added the new version of Get Element Attribute which uses 2 parameter…
ractoc Jul 22, 2019
aaf73e6
Merge pull request #78 from ractoc/develop
Hi-Fi Jul 25, 2019
265e2b1
Removed headfull browsers from testing
Hi-Fi Jul 25, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
.settings
.classpath
target
webdriver
webdriver
/libspecs/
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
language: java
dist: trusty

jdk:
- oraclejdk8

env:
- PROFILE=build
- PROFILE=build,googlechrome
- PROFILE=build,firefox
- PROFILE=build,googlechromeheadless
- PROFILE=build,firefoxheadless

Expand Down
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,26 @@ your pom.xml:
<dependency>
<groupId>com.github.hi-fi</groupId>
<artifactId>robotframework-seleniumlibrary</artifactId>
<version>3.141.59.26</version>
<version>3.141.59.265</version>
<scope>test</scope>
</dependency>

If you cannot use the robotframework-maven-plugin you can use the
[jar-with-dependencies](http://central.maven.org/maven2/com/github/hi-fi/robotframework-seleniumlibrary/3.141.59.26/robotframework-seleniumlibrary-3.141.59.26-jar-with-dependencies.jar),
which contains all required libraries. Running of tests with this can be done with command `java -jar robotframework-seleniumlibrary-3.141.59.26-jar-with-dependencies.jar <test location>`.
[jar-with-dependencies](http://central.maven.org/maven2/com/github/hi-fi/robotframework-seleniumlibrary/3.141.59.265/robotframework-seleniumlibrary-3.141.59.265-jar-with-dependencies.jar),
which contains all required libraries. Running of tests with this can be done with command `java -jar robotframework-seleniumlibrary-3.141.59.265-jar-with-dependencies.jar <test location>`.

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

Differences
-----------

* Some keyword differences between this and [Python version](https://github.com/robotframework/SeleniumLibrary) exists. (Same) keywords should be aligned in upcoming versions.
* Older version of the library was imported as `Library Selenium2Library` (both Java and Python versions). Since 2.53.1.1 (and all 3.x versions) import is done as `Library SeleniumLibrary`
* Older version of the library was imported as `Library Selenium2Library` (both Java and Python versions).
Since 2.53.1.1 (and later major versions) import is done as `Library SeleniumLibrary`


Browser drivers
Expand All @@ -86,6 +87,8 @@ to know when to update drivers you use.

Drivers can also be fetched with [https://github.com/Ardesco/selenium-standalone-server-plugin|Selenium Driver Binary Downloader plugin].

With At 3.141.59.265 [https://github.com/bonigarcia/webdrivermanager|WebdriverManager] is taken to use, so handling of drivers can also be done with standalone JAR from tests itself.

__ https://seleniumhq.github.io/selenium/docs/api/py/index.html#drivers
__ https://en.wikipedia.org/wiki/PATH_(variable)

Expand All @@ -96,7 +99,8 @@ This is a maven project. You can execute the integration tests (using [jBrowser]

mvn integration-test

Other browsers are behind profiles (require browser installation with Firefox and Google Chrome, but not driver):
Other browsers are behind profiles
(require browser installation with Firefox and Google Chrome, but not driver. Driver downloaded directly from Internet, so runner needs to have access to it.):

* Firefox: mvn integration-test -Pfirefox
* Google Chrome: mvn integration-test -Pgooglechrome
Expand Down
110 changes: 12 additions & 98 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.github.hi-fi</groupId>
<artifactId>robotframework-seleniumlibrary</artifactId>
<version>3.141.59.265-SNAPSHOT</version>
<version>3.141.59.2653-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Robot Framework :: SeleniumLibrary</name>
Expand Down Expand Up @@ -74,6 +74,7 @@
<selenium.version>3.141.59</selenium.version>
<keywords.class>SeleniumLibrary</keywords.class>
<browser>jbrowser</browser>
<downloadWebDriver>False</downloadWebDriver>
</properties>

<dependencies>
Expand Down Expand Up @@ -134,6 +135,11 @@
<version>2.18.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>3.4.0</version>
</dependency>
</dependencies>

<build>
Expand Down Expand Up @@ -198,27 +204,6 @@
</lifecycleMappingMetadata>
</configuration>
</plugin>
<plugin>
<groupId>com.lazerycode.selenium</groupId>
<artifactId>driver-binary-downloader-maven-plugin</artifactId>
<version>1.0.16</version>
<configuration>
<!-- root directory that downloaded driver binaries will be stored
in -->
<rootStandaloneServerDirectory>webdriver/binaries</rootStandaloneServerDirectory>
<!-- Where you want to store downloaded zip files -->
<downloadedZipFileDirectory>webdriver/zips</downloadedZipFileDirectory>
<!-- Location of a custom repository map -->
<customRepositoryMap>src/test/resources/RepositoryMap.xml</customRepositoryMap>
</configuration>
<executions>
<execution>
<goals>
<goal>selenium</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<!-- Integration-Test, build documentation -->
<groupId>org.robotframework</groupId>
Expand All @@ -236,6 +221,7 @@
<testCasesDirectory>${project.basedir}/src/test/robotframework/testsuites</testCasesDirectory>
<variables>
<variable>browser:${browser}</variable>
<variable>downloadWebDriver:${downloadWebDriver}</variable>
</variables>
<report>target/robotframework-reports/${browser}_report.html</report>
<log>target/robotframework-reports/${browser}_log.html</log>
Expand Down Expand Up @@ -379,101 +365,29 @@
<id>firefox</id>
<properties>
<browser>firefox</browser>
<downloadWebDriver>True</downloadWebDriver>
</properties>
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.selenium</groupId>
<artifactId>driver-binary-downloader-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.robotframework</groupId>
<artifactId>robotframework-maven-plugin</artifactId>
<configuration>
<externalRunner>
<jvmArgs>
<jvmArg>-Dwebdriver.gecko.driver=${webdriver.gecko.driver}</jvmArg>
</jvmArgs>
</externalRunner>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>firefoxheadless</id>
<properties>
<browser>firefoxheadless</browser>
<downloadWebDriver>True</downloadWebDriver>
</properties>
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.selenium</groupId>
<artifactId>driver-binary-downloader-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.robotframework</groupId>
<artifactId>robotframework-maven-plugin</artifactId>
<configuration>
<externalRunner>
<jvmArgs>
<jvmArg>-Dwebdriver.gecko.driver=${webdriver.gecko.driver}</jvmArg>
</jvmArgs>
</externalRunner>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>googlechrome</id>
<properties>
<browser>googlechrome</browser>
<downloadWebDriver>True</downloadWebDriver>
</properties>
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.selenium</groupId>
<artifactId>driver-binary-downloader-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.robotframework</groupId>
<artifactId>robotframework-maven-plugin</artifactId>
<configuration>
<externalRunner>
<jvmArgs>
<jvmArg>-Dwebdriver.chrome.driver=${webdriver.chrome.driver}</jvmArg>
</jvmArgs>
</externalRunner>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>googlechromeheadless</id>
<properties>
<browser>googlechromeheadless</browser>
<downloadWebDriver>True</downloadWebDriver>
</properties>
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.selenium</groupId>
<artifactId>driver-binary-downloader-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.robotframework</groupId>
<artifactId>robotframework-maven-plugin</artifactId>
<configuration>
<externalRunner>
<jvmArgs>
<jvmArg>-Dwebdriver.chrome.driver=${webdriver.chrome.driver}</jvmArg>
</jvmArgs>
</externalRunner>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>release</id>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.github.markusbernhardt.seleniumlibrary;

import com.github.markusbernhardt.seleniumlibrary.keywords.BrowserManagement;
import com.github.markusbernhardt.seleniumlibrary.keywords.Robot;
import org.openqa.selenium.WebDriver;

import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import java.lang.reflect.Field;

/**
* For extends of custom keywords of WebDriver actions
*/
public class CustomRobotDriverElement {

private static SeleniumLibrary s;
private static BrowserManagement b;
private Robot robot = new Robot();

public CustomRobotDriverElement() throws NoSuchFieldException, IllegalAccessException {
try {
CustomRobotDriverElement.s = getLibraryInstance();
} catch (ScriptException e) {
throw new SeleniumLibraryNonFatalException("Cannot create SeleniumLibrary instance.", e);
}
Field bmField = SeleniumLibrary.class.getDeclaredField("bm");
bmField.setAccessible(true);
b = (BrowserManagement) bmField.get(s);
bmField.setAccessible(false);
}

private static SeleniumLibrary getLibraryInstance() throws ScriptException {
ScriptEngine engine = new ScriptEngineManager().getEngineByName("python");
engine.put("library", "SeleniumLibrary");
engine.eval("from robot.libraries.BuiltIn import BuiltIn");
engine.eval("instance = BuiltIn().get_library_instance(library)");
return (SeleniumLibrary) engine.get("instance");
}

protected WebDriver getCurrentBrowser() {
return b.getCurrentWebDriver();
}

protected Robot getRobot() {
return robot;
}

}
Loading