0

I am launching several requests on different tabs. While one tab loads I will iteratively go to other tabs and see whether they have loaded correctly. The mechanism works great except for one thing: a lot of time is wasted "Waiting for (website)..."

The way in which I go from one tab to the other is launching an exception whenever a key element that I have to find is missing. But, in order to check for this exception (and therefore to proceed on other tabs, as it should do) what happens is that I have to wait for the request to end (so for the message "Waiting for..." to disappear).

Would it be possible not to wait? That is, would it be possible to launch the request via browser.get(..) and then immediately change tab?

2
  • 1
    Can you sum up your exact manual steps and your code trials please? Commented Sep 25, 2017 at 3:43
  • post our code at here Commented Sep 25, 2017 at 4:29

1 Answer 1

1

Yes you can do that. You need to change the pageLoadStrategy of the driver. Below is an example of firefox

import time
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium import webdriver

cap = DesiredCapabilities.FIREFOX
cap["pageLoadStrategy"] = "none"
print(DesiredCapabilities.FIREFOX)
driver = webdriver.Firefox(capabilities=cap)

driver.get("http://tarunlalwani.com")

#execute code for tab 2
#execute code for tab 3

Nothing will wait now and it is up to you to do all the waiting. You can also use eager instead of none

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.