protter
protter

Reputation: 131

Don't wait for a page to load using Selenium ChromeDriver in vba excel

i just want to get the final url from a redirect. I can read this with url = GC2.Url but the end takes a long time to load completely.

how do i get it now that as soon as i call the link with my 2nd selenium instance the webite doesn't wait for it and uses "none". but as soon as i close my 2nd instance again and continue with my first instant the normal time is used again. i have found some approaches here: Don't wait for a page to load using Selenium in Python

approximate example:

Set GC = New Selenium.ChromeDriver
Set GC2 = New Selenium.ChromeDriver

for c = 1 to 100
GC.Get link(c)
          Set Elements = GC.FindElementsByCss("p.TITLE a[href]")
          For Each Element In Elements
             ReDim Preserve links(a) As String
            links(a) = Element.Attribute("href") 'geht auch innerHTML/href usw.
            a = a + 1
             GC2.Get links(a)  ' this here should not wait so long
            redict(a) = GC2.Url
           GC2.Close
        Next Element

Upvotes: 0

Views: 809

Answers (1)

Tal Angel
Tal Angel

Reputation: 1788

Try to work in Headless mode, it might be faster. In this mode the browser doesn't open and everything happens with the "eyes closed", everything is virtual.

Upvotes: 0

Related Questions