8000 Updating docs for 0.9.0 tagging · seleniumQuery/seleniumQuery@d97ec60 · GitHub
[go: up one dir, main page]

Skip to content

Commit d97ec60

Browse files
committed
Updating docs for 0.9.0 tagging
1 parent 9b6cbf7 commit d97ec60

File tree

2 files changed

+37
-32
lines changed

2 files changed

+37
-32
lines changed

README.md

Lines changed: 36 additions & 31 deletions
8000
Original file line numberDiff line numberDiff line change
@@ -36,54 +36,37 @@ import static io.github.seleniumquery.SeleniumQuery.$; // this will allow the sh
3636

3737
public class SeleniumQueryExample {
3838
public static void main(String[] args) {
39-
// sets Firefox as the driver -- this is optional, if omitted, will default
40-
// to HtmlUnit or whatever you set at the, also optional, config files
41-
//
42-
$.driver().useFirefox().withoutJavaScript(); // JS will be disabled!
39+
// sets Firefox as the driver (this is optional, if omitted, will default to HtmlUnit)
40+
$.driver().useFirefox().withoutJavaScript(); // JavaScript will be disabled!
4341

44-
$.url("http://www.google.com/?hl=en");
42+
$.url("http://www.google.com/?hl=en");
4543

46-
$(":text[name='q']").val("selenium"); // the keys are actually typed
47-
$(":button:contains('Google Search')").click();
44+
$(":text[name='q']").val("selenium"); // the keys are actually typed!
45+
$(":button:contains('Google Search')").click();
4846

49-
String resultsText = $("#resultStats").text();
50-
System.out.println(resultsText);
47+
// Alternatively: $(":text[name='q']").val("selenium").submit();
5148

52-
// Besides the short syntax and the jQuery behavior you already know,
53-
// other very useful function in seleniumQuery is .waitUntil(),
54-
// handy for dealing with Ajax enabled pages:
55-
//
56-
$(":input[name='q']").waitUntil().is(":enabled");
57-
// The line above waits for no time, as that input is always enabled in google.com
49+
// Besides the short syntax and the jQuery behavior you already know,
50+
// other very useful function in seleniumQuery is .waitUntil(),
51+
// handy for dealing with user-waiting actions (specially in Ajax enabled pages):
52+
String resultsText = $("#resultStats").waitUntil().is(":visible").then().text();
53+
System.out.println(resultsText);
5854

59-
$.quit(); // quits the currently used driver (firefox)
55+
$.quit(); // quits the currently used driver (firefox)
6056
}
6157
}
6258
```
63-
The code above can be found at the sample [seleniumQuery demos project](https://github.com/seleniumQuery/seleniumQuery-demos).
59+
The code above can be found at the [seleniumQuery demos project](https://github.com/seleniumQuery/seleniumQuery-demos).
6460

6561
To get seleniumQuery's latest snapshot, add this to your **`pom.xml`**:
6662
```xml
6763
<dependencies>
6864
<dependency>
6965
<groupId>io.github.seleniumquery</groupId>
7066
<artifactId>seleniumquery</artifactId>
71-
<version>0.9.0-SNAPSHOT</version>
67+
<version>0.9.0</version>
7268
</dependency>
7369
</dependencies>
74-
<!-- The repository the snapshots will be downloaded from.
75-
Can either go in your pom.xml or settings.xml -->
76-
<repositories>
77-
<repository>
78-
<id>sonatype-nexus-snapshots</id>
79-
<name>Sonatype Nexus Snapshots</name>
80-
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
81-
<snapshots>
82-
<enabled>true</enabled>
83-
<updatePolicy>always</updatePolicy>
84-
</snapshots>
85-
</repository>
86-
</repositories>
8770
```
8871

8972
<br>
@@ -164,6 +147,28 @@ String oldStreetz = jQuery("input.street").val();
164147
jQuery("input.street").val("5th St!");
165148
```
166149

150+
<br>
151+
152+
##seleniumQuery still is Selenium - with "just" a jQuery interface
153+
154+
That's why it can work with disabled JavaScript!
155+
156+
But there is a more important aspect of that: As our functions yield the same result as if you were using jQuery, remember we always execute them from the user perspective.
157+
In other words, when you call:
158+
```java
159+
$(":input[name='email']").val("seleniumQuery@example.com");
160+
```
161+
162+
We don't change the `value` attribute directly like jQuery does. We actually do as a user would: We clear the input
163+
and type, key by key, the string provided as argument!
164+
165+
But we go the **extra mile**: Our `$().val()` works even on `contenteditable` elements: They don't have `value`, but we type
166+
the text in them, again, key by key, as an user would!
167+
168+
###Always from the user perspective
169+
170+
On the same tone, when selecting/checking `<option>`s or checkboxes or radios, try not to use `$().prop("selected", true)` directly to them.
171+
Do as an user would: call `.click()`!
167172

168173
<br>
169174

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@
162162
<id>release-sign-artifacts</id>
163163
<activation>
164164
<property>
165-
<name>performRelease</name>
165+
<name>performReleasey</name>
166166
<value>true</value>
167167
</property>
168168
</activation>

0 commit comments

Comments
 (0)
0