Skip to content

Commit 4665752

Browse files
committed
added initial sample code
1 parent c730237 commit 4665752

11 files changed

+153
-12
lines changed

.gitignore

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
*.class
1+
# ECLIPSE
2+
#
3+
/target
4+
/.settings
5+
.project
6+
.classpath
27

3-
# Mobile Tools for Java (J2ME)
4-
.mtj.tmp/
8+
# IntelliJ IDEA
9+
#
10+
*.iml
11+
/.idea
512

6-
# Package Files #
7-
*.jar
8-
*.war
9-
*.ear
10-
11-
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
12-
hs_err_pid*
13+
# Others
14+
#
15+
errorPage.html
16+
phantomjsdriver.log
17+
errorPage.png

LICENSE

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
22-
21+
SOFTWARE.

pom.xml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
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">
3+
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>io.github.seleniumquery</groupId>
6+
<artifactId>seleniumquery-demos</artifactId>
7+
<version>0.9.0-SNAPSHOT</version>
8+
9+
<name>seleniumQuery demos</name>
10+
<url>http://seleniumquery.github.io/</url>
11+
<description>Cross-driver jQuery-like Java interface for Selenium WebDriver.</description>
12+
13+
<properties>
14+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
15+
</properties>
16+
17+
<dependencies>
18+
<dependency>
19+
<groupId>io.github.seleniumquery</groupId>
20+
<artifactId>seleniumquery</artifactId>
21+
<version>0.9.0-SNAPSHOT</version>
22+
</dependency>
23+
24+
<!-- BELOW, TEST DEPENDENCIES ONLY -->
25+
<dependency>
26+
<groupId>junit</groupId>
27+
<artifactId>junit</artifactId>
28+
<version>4.11</version>
29+
<scope>test</scope>
30+
<exclusions>
31+
<exclusion>
32+
<groupId>org.hamcrest</groupId>
33+
<artifactId>hamcrest-core</artifactId>
34+
</exclusion>
35+
</exclusions>
36+
</dependency>
37+
<dependency>
38+
<groupId>org.hamcrest</groupId>
39+
<artifactId>hamcrest-all</artifactId>
40+
<version>1.3</version>
41+
<scope>test</scope>
42+
</dependency>
43+
<dependency>
44+
<groupId>org.mockito</groupId>
45+
<artifactId>mockito-core</artifactId>
46+
<version>1.10.8</version>
47+
<scope>test</scope>
48+
<exclusions>
49+
<exclusion>
50+
<artifactId>hamcrest-core</artifactId>
51+
<groupId>org.hamcrest</groupId>
52+
</exclusion>
53+
</exclusions>
54+
</dependency>
55+
</dependencies>
56+
57+
<repositories>
58+
<repository>
59+
<id>sonatype-nexus-snapshots</id>
60+
<name>Sonatype Nexus Snapshots</name>
61+
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
62+
<snapshots>
63+
<enabled>true</enabled>
64+
<updatePolicy>always</updatePolicy>
65+
</snapshots>
66+
</repository>
67+
</repositories>
68+
69+
<build>
70+
<plugins>
71+
<plugin>
72+
<groupId>org.apache.maven.plugins</groupId>
73+
<artifactId>maven-compiler-plugin</artifactId>
74+
<version>3.2</version>
75+
<configuration>
76+
<source>1.6</source>
77+
<target>1.6</target>
78+
<encoding>UTF-8</encoding>
79+
</configuration>
80+
</plugin>
81+
</plugins>
82+
</build>
83+
84+
</project>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package other;
2+
3+
import static io.github.seleniumquery.SeleniumQuery.$; // this will allow the short syntax
4+
5+
public class SeleniumQueryExample {
6+
public static void main(String[] args) {
7+
// sets Firefox as the driver -- this is optional, if omitted, will default
8+
// to HtmlUnit or whatever you set at the, also optional, config files
9+
//
10+
$.driver().useFirefox().withoutJavaScript(); // JS will be disabled!
11+
12+
$.url("http://www.google.com/?hl=en");
13+
14+
$(":text[name='q']").val("selenium"); // the keys are actually typed
15+
$(":button:contains('Google Search')").click();
16+
17+
String resultsText = $("#resultStats").text();
18+
System.out.println(resultsText);
19+
20+
// Besides the short syntax and the jQuery behavior you already know,
21+
// other very useful function in seleniumQuery is .waitUntil(),
22+
// handy for dealing with Ajax enabled pages:
23+
//
24+
$(":input[name='q']").waitUntil().is(":enabled");
25+
// The line above waits for no time, as that input is always enabled in google.com
26+
27+
$.quit(); // quits the currently used driver (firefox)
28+
}
29+
}

src/main/resources/IEDriverServer.exe

2.5 MB
Binary file not shown.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
File: IEDriverServer_Win32_2.41.0.zip
2+
Downloaded from: http://selenium-release.storage.googleapis.com/2.41/IEDriverServer_Win32_2.41.0.zip
3+
When: 20/05/2014

src/main/resources/chromedriver.exe

6.05 MB
Binary file not shown.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
File: chromedriver_win32_2.10.zip
2+
Downloaded from: http://chromedriver.storage.googleapis.com/2.10/chromedriver_win32.zip
3+
When: 20/05/2014

src/main/resources/phantomjs.exe

6.69 MB
Binary file not shown.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
File: phantomjs-1.9.7-windows.zip
2+
Downloaded from: http://cdn.bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-windows.zip
3+
When: 21/05/2014

0 commit comments

Comments
 (0)