evaluateJavascript("document.getElementById('firstname').focus()");
+evaluateJavascript("document.getElementById('firstname').focus()");
diff --git a/theserenitybook/latest/page-objects.html b/theserenitybook/latest/page-objects.html index aeac1390..a1141194 100644 --- a/theserenitybook/latest/page-objects.html +++ b/theserenitybook/latest/page-objects.html @@ -954,20 +954,23 @@
evaluateJavascript("document.getElementById('firstname').focus()");
+evaluateJavascript("document.getElementById('firstname').focus()");
And, if you are familiar with JQuery, you can also invoke JQuery expressions:
+And, if you are familiar with JQuery, you can also invoke JQuery expressions, as Serenity will automatically inject a bundled version of JQuery into each page, unless the page already includes it:
evaluateJavascript("$('#firstname').focus()");
+evaluateJavascript("$('#firstname').focus()");
This is often a useful strategy if you need to trigger events such as mouse-overs that are not currently supported by the WebDriver API.
You can disable the injection of JQuery by setting serenity.jquery.integration
to false
in your serenity.conf
, as this can speed up the page load.