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

Remove extra dependencies #87

Merged
merged 33 commits into from
Aug 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
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
54dae8b
Added HTMLUnit support back
Hi-Fi Jul 23, 2019
01b20bb
Changed android and ios testing dependencies as provided so those are…
Hi-Fi Jul 24, 2019
f873072
Updating keys manually before update
Hi-Fi Jul 25, 2019
43198b7
Testing only headless browsers (issues with Trusty and Xvfb)
Hi-Fi Jul 25, 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
891dbe5
Merge pull request #1 from Hi-Fi/develop
YauheniPo Jul 27, 2019
cf75328
Code refactoring
YauheniPo Jul 27, 2019
c7961e0
Code refactoring
YauheniPo Jul 27, 2019
15982cc
Added keywords for data utils
YauheniPo Jul 27, 2019
9b83f26
Corrected by review comments
YauheniPo Jul 28, 2019
6293b92
Corrected by review comments
YauheniPo Jul 28, 2019
3e8bc73
Merge pull request #82 from YauheniPo/feature/data_utils_keywords
Hi-Fi Jul 29, 2019
6b85626
Merge pull request #81 from YauheniPo/feature/code_refactoring
Hi-Fi Jul 29, 2019
006f979
Merge branch 'develop' of github.com:Hi-Fi/robotframework-seleniumlib…
Hi-Fi Jul 29, 2019
d7a23e4
Added the missing @RobotKeywordOverload. This annotation is needed to…
Jul 30, 2019
9e2f4f0
The attribute name is now determined dynamically, as per the comment …
Aug 5, 2019
786a4eb
Formatting fix
Aug 5, 2019
a2a59ca
Merge pull request #84 from ractoc/develop
Hi-Fi Aug 26, 2019
28e2a87
Merge pull request #86 from Hi-Fi/addHtmlUnitBack
Hi-Fi Aug 26, 2019
8e4cc94
Release 3.141.59.2653
Hi-Fi Aug 26, 2019
fed6f0e
Bumb up
Hi-Fi Aug 26, 2019
ded6cc6
Merge branch 'develop' of github.com:Hi-Fi/robotframework-seleniumlib…
Hi-Fi Aug 26, 2019
245c8fd
Updated dependencies
Hi-Fi Aug 26, 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
11 changes: 2 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
language: java

matrix:
include:
- os: linux
- os: osx
osx_image: xcode9.3
dist: trusty

jdk:
- oraclejdk8

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

stages:
- test
Expand All @@ -30,7 +24,6 @@ addons:
before_install:
- if [ ! -z "$GPG_SECRET_KEYS" ]; then echo $GPG_SECRET_KEYS | base64 --decode | $GPG_EXECUTABLE --import; fi
- if [ ! -z "$GPG_OWNERTRUST" ]; then echo $GPG_OWNERTRUST | base64 --decode | $GPG_EXECUTABLE --import-ownertrust; fi
- .travis/setup_xvfb.sh

install: mvn --settings .travis/settings.xml verify -Dgpg.skip -B -V -P$PROFILE
script: skip
Expand Down
1 change: 1 addition & 0 deletions .travis/setup_xvfb.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 762E3157
sudo apt-get -qq update
sudo apt-get install -y dbus-x11
export DISPLAY=:99.0
Expand Down
21 changes: 13 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,22 @@ your pom.xml:
<dependency>
<groupId>com.github.hi-fi</groupId>
<artifactId>robotframework-seleniumlibrary</artifactId>
<version>3.141.59.26</version>
<version>3.141.59.2653</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.2653/robotframework-seleniumlibrary-3.141.59.2653-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.2653-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.2653/robotframework-seleniumlibrary-3.141.59.2653.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.2653/robotframework-seleniumlibrary-3.141.59.2653.xml)
and place it in your PYTHONPATH.

Usage, Selenium 4 (WIP)
-----------------
-----------------------

If you are using the robotframework-maven-plugin you can
use this library by adding the following dependency to
Expand All @@ -75,14 +75,19 @@ your pom.xml:

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/4.0.0-alpha-1.0/robotframework-seleniumlibrary-4.0.0-alpha-1.0-jar-with-dependencies.jar),
which contains all required libraries. Running of tests with this can be done with command `java -jar robotframework-seleniumlibrary-4.0.0-alpha-1.0-jar-with-dependencies.jar <test location>`.
which contains all required libraries except ios/android ones (Appium and Selendroid). Running of tests with this can be done with command `java -jar robotframework-seleniumlibrary-4.0.0-alpha-1.0-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/4.0.0-alpha-1.0/robotframework-seleniumlibrary-4.0.0-alpha-1.0.html).
* For keyword completion in RIDE you can download this
[Library Specs](http://central.maven.org/maven2/com/github/hi-fi/robotframework-seleniumlibrary/4.0.0-alpha-1.0/robotframework-seleniumlibrary-4.0.0-alpha-1.0.xml)
and place it in your PYTHONPATH.

Testing IOS/Android browsers with library
-----------------------------------------
Pre-Selenium 4 fat-jar contains Appium and Selendroid that allow testing of IOS and Android browsers. Those are dropped in Selenium 4 -versions,
so dependencies needs to be handles self with either Maven/Gradle or manually. If there's need to have fat-jar with those, please create issue about that.

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

Expand Down Expand Up @@ -111,7 +116,7 @@ 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 Selenium 4 [https://github.com/bonigarcia/webdrivermanager|WebdriverManager] is taken to use, so handling of drivers can also be done with standalone JAR from tests itself.
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 Down
56 changes: 47 additions & 9 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>4.0.0-alpha-1.0-SNAPSHOT</version>
<version>4.0.0-alpha-2.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Robot Framework :: SeleniumLibrary</name>
Expand Down Expand Up @@ -71,7 +71,7 @@
<java.version>1.8</java.version>
<robotframework.maven.plugin.version>1.5.1</robotframework.maven.plugin.version>
<robotframework.version>3.1.2</robotframework.version>
<selenium.version>4.0.0-alpha-1</selenium.version>
<selenium.version>4.0.0-alpha-2</selenium.version>
<keywords.class>SeleniumLibrary</keywords.class>
<browser>jbrowser</browser>
<downloadWebDriver>False</downloadWebDriver>
Expand Down Expand Up @@ -113,11 +113,12 @@
<artifactId>selenium-java</artifactId>
</exclusion>
</exclusions>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>7.0.0</version>
<version>7.2.0</version>
<exclusions>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
Expand All @@ -128,6 +129,7 @@
<artifactId>selenium-api</artifactId>
</exclusion>
</exclusions>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand All @@ -137,7 +139,36 @@
<dependency>
<groupId>com.machinepublishers</groupId>
<artifactId>jbrowserdriver</artifactId>
<version>1.1.0-RC1</version>
<version>1.1.0-RC2</version>
<exclusions>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
</exclusion>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>htmlunit-driver</artifactId>
<version>2.36.0</version>
<exclusions>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
</exclusion>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-support</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
Expand All @@ -148,7 +179,7 @@
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>3.4.0</version>
<version>3.6.2</version>
</dependency>
</dependencies>

Expand Down Expand Up @@ -288,7 +319,7 @@
<!-- Weave the failure handler into the code -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.10</version>
<version>1.11</version>
<executions>
<execution>
<goals>
Expand Down Expand Up @@ -318,7 +349,7 @@
<!-- Set 1.7 as target, use project source encoding -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<version>3.8.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
Expand Down Expand Up @@ -346,7 +377,7 @@
<!-- Build the fat jar with all dependencies -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<version>3.1.0</version>
<configuration>
<archive>
<manifest>
Expand All @@ -371,6 +402,13 @@
</plugins>
</build>
</profile>
<profile>
<id>htmlunitwithjs</id>
<properties>
<browser>htmlunitwithjs</browser>
<downloadWebDriver>False</downloadWebDriver>
</properties>
</profile>
<profile>
<id>firefox</id>
<properties>
Expand Down Expand Up @@ -432,7 +470,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.10</version>
<version>3.0.0</version>
<executions>
<execution>
<id>attach-artifacts</id>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.github.markusbernhardt.seleniumlibrary;

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

Expand All @@ -16,7 +17,8 @@ public class CustomRobotDriverElement {

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

public CustomRobotDriverElement() throws NoSuchFieldException, IllegalAccessException {
try {
Expand All @@ -41,9 +43,4 @@ private static SeleniumLibrary getLibraryInstance() throws ScriptException {
protected WebDriver getCurrentBrowser() {
return b.getCurrentWebDriver();
}

protected Robot getRobot() {
return robot;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ public SeleniumLibrary(String timeout, String implicitWait, String keywordToRunO
if (!screenshotPath.isEmpty()) {
screenshot.setScreenshotDirectory(screenshotPath);
}

}

// ##############################
Expand All @@ -79,7 +78,6 @@ public SeleniumLibrary(String timeout, String implicitWait, String keywordToRunO
@Autowired
Screenshot screenshot;


@Override
public String getKeywordDocumentation(String keywordName) {
if (keywordName.equals("__intro__")) {
Expand Down Expand Up @@ -185,6 +183,5 @@ public String getKeywordDocumentation(String keywordName) {
}
}
return keywordName;

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.ie.InternetExplorerOptions;
import org.openqa.selenium.remote.Augmenter;
Expand Down Expand Up @@ -165,7 +166,9 @@ public void closeBrowser() {
"| Safari | safari |\r\n" +
"| Android | android |\r\n" +
"| Iphone | iphone |\r\n" +
"| JBrowser | jbrowser |\r\n" +
"| JBrowser | jbrowser |\r\n" +
"| HTMLUnit | htmlunit |\r\n" +
"| HTMLUnit with Javascript | htmlunitwithjs |\r\n" +
"\r\n" +
"To be able to actually use one of these browsers, you need to have a matching Selenium browser driver available. See the [https://github.com/Hi-Fi/robotframework-seleniumlibrary-java#browser-drivers|project documentation] for more details.\r\n" +
"\r\n" +
Expand Down Expand Up @@ -672,6 +675,12 @@ protected WebDriver createLocalWebDriver(String browserName, Capabilities desire
} catch (Exception e) {
throw new SeleniumLibraryFatalException("Creating " + browserName + " instance failed.", e);
}
case "htmlunit":
return new HtmlUnitDriver(desiredCapabilities);
case "htmlunitwithjs":
HtmlUnitDriver driver = new HtmlUnitDriver(desiredCapabilities);
driver.setJavascriptEnabled(true);
return driver;
default:
throw new SeleniumLibraryFatalException(browserName + " is not a supported browser.");
}
Expand Down Expand Up @@ -761,6 +770,11 @@ protected Capabilities createCapabilities(String browserName, String desiredCapa
case "jbrowser":
desiredCapabilities = new DesiredCapabilities("jbrowser", "1", Platform.ANY);
break;
case "htmlunit":
case "htmlunitwithjs":
desiredCapabilities = DesiredCapabilities.htmlUnit();
((DesiredCapabilities) desiredCapabilities).setBrowserName("htmlunit");
break;
default:
throw new SeleniumLibraryFatalException(browserName + " is not a supported browser.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ public void deleteCookie(String name) {

@RobotKeyword("Returns all cookies of the current page.")
public String getCookies() {
StringBuffer ret = new StringBuffer();
StringBuilder ret = new StringBuilder();

ArrayList<org.openqa.selenium.Cookie> cookies = new ArrayList<org.openqa.selenium.Cookie>(browserManagement
ArrayList<org.openqa.selenium.Cookie> cookies = new ArrayList<>(browserManagement
.getCurrentWebDriver().manage().getCookies());
for (int i = 0; i < cookies.size(); i++) {
ret.append(cookies.get(i).getName() + "=" + cookies.get(i).getValue());
ret.append(cookies.get(i).getName()).append('=').append(cookies.get(i).getValue());
if (i != cookies.size() - 1) {
ret.append("; ");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package com.github.markusbernhardt.seleniumlibrary.keywords;

import com.github.markusbernhardt.seleniumlibrary.RunOnFailureKeywordsAdapter;
import org.robotframework.javalib.annotation.ArgumentNames;
import org.robotframework.javalib.annotation.Autowired;
import org.robotframework.javalib.annotation.RobotKeyword;
import org.robotframework.javalib.annotation.RobotKeywords;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;

@RobotKeywords
public class DataUtils extends RunOnFailureKeywordsAdapter {

private static final String ASCENDING = "ascending";
private static final String DESCENDING = "descending";

@Autowired
protected Robot robot;

/**
* Instantiated Logging keyword bean
*/
@Autowired
protected Logging logging;

// ##############################
// Keywords
// ##############################

/**
* Sort list of strings.
*
* @param jsonStringOfList json string of list strings
* @param params sorting order
* @return sorting list of strings
*/
@RobotKeyword("Returns sorting list of strings by ``order``.")
@ArgumentNames({"list", "order=ascending"})
public List<String> sortStrings(String jsonStringOfList, String... params) {
List<String> listOfStrings = robot.parseRobotList(jsonStringOfList);
String order = robot.getParamsValue(params, 0, ASCENDING);
List<String> sortedList = new ArrayList<>(listOfStrings);
if (order.equalsIgnoreCase(DESCENDING)) {
listOfStrings.sort(Collections.reverseOrder());
} else {
Collections.sort(listOfStrings);
}
logging.info(String.format("Sorted list '%s' by %s", sortedList, order.toUpperCase(Locale.ENGLISH)));
return sortedList;
}
}
Loading