Multiple driver support
Occasionally, testing requires more than one client to be involved in a test. There will be cases where there are two browsers open at the same time, whether they are running the same application or not, and cases where there are one browser and one mobile device running simultaneously. This section will cover the requirements for running concurrent web and mobile drivers.
Dual WebDriver testing
The tricky part about running two or more WebDrivers at the same time is that you must keep track of which driver is getting the WebDriver events at any point in time. Otherwise, the current WebDriver, which is the last one that gets instantiated, gets all the events. How do we do that?
It's actually not that difficult. What needs to be done is this:
- Create the first WebDriver instance.
- Assign the first WebDriver instance to a variable.
- Create the second WebDriver instance.
- Assign the second WebDriver instance to a variable.
- Switch back and forth between the two drivers using the...