June 2018
Beginner to intermediate
376 pages
8h 58m
English
The logical progression is of course to write your own JavaScript libraries that you can import instead of sending everything over as a string. Alternatively, maybe you would just like to import an existing library.
Let's write some code that allows you to import a JavaScript library of your choice. It's not particularly complex JavaScript. All that we are going to do is create a new <script> element in a page and then load our library into it. First of all, let's make sure we have access to a driver object in this class:
private RemoteWebDriver driver;@BeforeMethodpublic void setup() { driver = getDriver();}
Then we will need to add some code that will let us inject a <script> element:
private void injectScript ...
Read now
Unlock full access