Thursday, May 23, 2024
 Popular · Latest · Hot · Upcoming
104
rated 0 times [  106] [ 2]  / answers: 1 / hits: 6190  / 10 Years ago, fri, june 27, 2014, 12:00:00

How can I make my webdriver request multiple pages (or open multiple browsers) at the same time, concurrently?



All solutions I found on the internet waits until the previous session has finished loading and only then open a new instance of the browser.



I have tried selenium-webdriver, webdriverjs and wdjs, and none of them seem to be able to do multiple http requests for different pages asynchronously. Even solutions like this https://github.com/OniOni/wd-parallel-async wont work. They all open one at time.



Am I missing something?



PS: I don't want to run multiple browsers concurrently! I want to run multiple instances of the same browser.


More From » node.js

 Answers
10

Something like:



WebDriver driver1 = new FirefoxDriver();
WebDriver driver2 = new FirefoxDriver();
WebDriver driver3 = new FirefoxDriver();
driver1.get(page1);
driver2.get(page2);
driver3.get(page3);


If you need it truly asynchronous, then you will need to get into Java threading ... which would make this into a longer discussion and off-topic for SO.


[#44266] Thursday, June 26, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
alekgermanb

Total Points: 616
Total Questions: 86
Total Answers: 105

Location: Aland Islands
Member since Thu, Dec 23, 2021
2 Years ago
alekgermanb questions
Sun, Mar 20, 22, 00:00, 2 Years ago
Sat, Jan 2, 21, 00:00, 3 Years ago
Sun, Nov 17, 19, 00:00, 5 Years ago
;