Automatically extract website data to a spreadsheet

Corried

Board Regular
Joined
Dec 19, 2019
Messages
217
Office Version
  1. 2019
Platform
  1. Windows
  2. Web
Hello, Thank you for sharing..

I am looking for courses on how to automatically extract data from a website to an excel spreadsheet.

The excel file contains fifty links. Each link has the same process, to create a stock market report for fifty companies. Use macro and chrome to generate data.

Can anyone show me a step by step process on how I can do this?

Please watch the video and Excel workbook below to learn more.



I hope you all understand.

Cheers
 
Yes. You are right. I did update same an it working okay. I am sorry for the late reply...

Hope your computer gets well soon...
 
Upvote 0

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Here is a partial view of my result :

autom(AutoRecovered).xlsm
ABCDEF
1Websites Top 100CompanySymbolP/EPriceSales Growth Yr Over Yr
2https://www.msn.com/en-us/money/stockdetails/fi-c4jjp2?duration=1DAMYLYX PHARMACEUTICALS, INC.AMLX-27,81-5
3https://www.msn.com/en-us/money/stockdetails/fi-a1nhlh?duration=1DAMAZON.COM, INC.AMZN43,042.936,359,44
4
Sheet11


VBA Code:
Public driver As New ChromeDriver
Sub Money()
Dim pt As WebElement, key As New Selenium.Keys, s$, i%
driver.get "https://www.msn.com/en-us/money/stockdetails/fi-bjqejc?duration=1D"
Application.Wait Now + TimeValue("0:00:06")
For i = 2 To 3      ' rows
    MsgBox "Starting " & Cells(i, 3)
    If i > 2 Then driver.SwitchToPreviousWindow
    Set pt = driver.FindElementByXPath("//*[@id=""searchBox""]/input")
    pt.Click
    pt.SendKeys ActiveSheet.Cells(i, 3)
    Application.Wait Now + TimeValue("0:00:06")
    DoEvents
    Set pt = driver.FindElementByCss("#searchBox > span > span > svg")
    pt.Click
    Application.Wait Now + TimeValue("0:00:10")
    DoEvents
    Cells(i, 1) = driver.URL
    Cells(i, 2) = driver.FindElementByCss("#root > div:nth-child(1) > div > div.mainContentLayout-DS-EntryPoint1-1" & _
    " > div > div > div:nth-child(1) > div > div.firstSection-DS-EntryPoint1-1 > div.quoteInfo-DS-EntryPoint1-1" & _
    " > div.title-DS-EntryPoint1-1 > span.displayName-DS-EntryPoint1-1").Text
    Cells(i, 4) = driver.FindElementByXPath("//*[@id=""root""]/div[1]/div/div[5]/div/div/div[2]/div/div[2]/div[2]/div[8]/div[2]").Text
    On Error Resume Next
    ' green
    Set pt = driver.FindElementByCss("#root > div:nth-child(1) > div > div.mainContentLayout-DS-EntryPoint1-1 >" & _
    " div > div > div:nth-child(1) > div > div.secondSection-DS-EntryPoint1-1 > div.priceInfo-DS-EntryPoint1-1" & _
    " > div > div.mainPrice.color_green-DS-EntryPoint1-1")
    If Err.Number = 0 Then
        Cells(i, 5) = pt.Text
    Else
        Cells(i, 5) = driver.FindElementByCss("#root > div:nth-child(1) > div > div.mainContentLayout-DS-EntryPoint1-1 >" & _
        " div > div > div:nth-child(1) > div > div.secondSection-DS-EntryPoint1-1 > div.priceInfo-DS-EntryPoint1-1 > div >" & _
        " div.mainPrice.color_red-DS-EntryPoint1-1").Text
    End If
    On Error GoTo 0
    s = driver.FindElementByXPath("//*[@id=""root""]/div[1]/div/div[5]/div/div/div[2]/div/div[2]/div[1]/div[2]/div/div[3]/span[2]").Text
    s = s & " / " & _
    driver.FindElementByXPath("//*[@id=""root""]/div[1]/div/div[5]/div/div/div[2]/div/div[2]/div[1]/div[2]/div/div[3]/span[1]").Text
    Cells(i, 8) = s
    Cells(i, 10) = driver.FindElementByXPath("//*[@id=""root""]/div[1]/div/div[5]/div/div/div[2]/div/div[2]/div[2]/div[5]/div[2]").Text
    ' 5-year
    driver.FindElementByXPath("//*[@id=""root""]/div[1]/div/div[5]/div/div/div[2]/div/div[1]/div[2]/div/div/button[8]").Click
    Application.Wait Now + TimeValue("0:00:10")
    Cells(i, 9) = driver.FindElementByCss("#root > div:nth-child(1) > div > div.mainContentLayout-DS-EntryPoint1-1 > div >" & _
    " div > div:nth-child(2) > div > div.comparisonTable-DS-EntryPoint1-1 > div > table > tbody > tr.tableLastRow-DS-EntryPoint1-1" & _
    " > td:nth-child(12) > div").Text
    ' analysis
    On Error Resume Next
    Set pt = driver.FindElementByCss("#root > div:nth-child(1) > div > div.mainContentLayout-DS-EntryPoint1-1 > div > div >" & _
    " div:nth-child(1) > div > div.secondSection-DS-EntryPoint1-1 > div.navigation-DS-EntryPoint1-1 > div > div > button:nth-child(5) > span")
    If Err.Number = 0 Then
        pt.Click
    Else
        driver.FindElementByCss("#root > div:nth-child(1) > div > div.mainContentLayout-DS-EntryPoint1-1 > div > div > div:nth-child(1)" & _
        " > div > div.secondSection-DS-EntryPoint1-1 > div.navigation-DS-EntryPoint1-1 > div > div > button:nth-child(2) > span").Click
    End If
    On Error GoTo 0
    Application.Wait Now + TimeValue("0:00:10")
    driver.SwitchToNextWindow
    s = driver.FindElementByXPath _
    ("//*[@id=""main""]/div[2]/div[2]/div[2]/div[3]/div/div/div[5]/div[1]/div[2]/div[1]/div[1]/div[1]/div[2]/div/div[2]/div/ul[2]/li[2]/p").Text
    s = s & " / " & driver.FindElementByXPath _
    ("//*[@id=""main""]/div[2]/div[2]/div[2]/div[3]/div/div/div[5]/div[1]/div[2]/div[1]/div[1]/div[1]/div[2]/div/div[2]/div/ul[3]/li[2]/p").Text
    Cells(i, 7) = s
    Cells(i, 12) = driver.FindElementByXPath("//*[@id=""main""]/div[2]/div[2]/div[2]/div[3]/" & _
    "div/div/div[5]/div[1]/div[2]/div[1]/div[1]/div[1]/div[2]/div/div[2]/div/ul[6]/li[2]/p").Text
    Cells(i, 11) = driver.FindElementByXPath _
    ("//*[@id=""main""]/div[2]/div[2]/div[2]/div[4]/div/div/div[5]/div[1]/div[2]/div[1]/div[1]/div/div/div/ul[1]/li[2]/span[1]/p").Text
    ' growth
    Application.Wait Now + TimeValue("0:00:12")
    Set pt = driver.FindElementByCss _
    ("#main > div.content-div.fullwidth.loaded > div.main-region.maincontainer.fullwidth.stckdtl" _
    & " > div.dynaloadable > div:nth-child(4) > div > div > div.key-stats-area > ul > li:nth-child(2)")
    pt.Click
    Application.Wait Now + TimeValue("0:00:06")
    Cells(i, 6) = driver.FindElementByXPath("//*[@id=""main""]/div[2]/div[2]/div[2]/div[3]/" & _
    "div/div/div[5]/div[1]/div[2]/div[2]/div[1]/div/div/div/ul[1]/li[2]/span[1]/p").Text
    ' company
    driver.FindElementByXPath("//*[@id=""profile""]/a").Click
    Application.Wait Now + TimeValue("0:00:10")
    driver.FindElementByXPath("//*[@id=""main""]/div[2]/div[2]/div[2]/div/div[3]/div/div[2]/div[2]/div/button[1]").Click
    Application.Wait Now + TimeValue("0:00:06")
    Cells(i, 13) = driver.FindElementByXPath("//*[@id=""main""]/div[2]/div[2]/div[2]/div/div[3]/div/div[2]/div[1]").Text
    driver.Close    ' second window
Next
End Sub
 
Upvote 0
Thank you, Wolf, for your sacrifice and your commitment.
I am not sure if I have done something wrong. If I have to move forward. This problem has to be resolved...

Thanks in advance

Capture.JPG
 
Upvote 0
Check if the reference for the Selenium Type Library is ticked at the VBE.
 
Upvote 0
I am not sure why it stopped working. Yesterday I reinstall windows. I updated Chrome and Selenium. Whrn I discovered it was not working, I did check and tick Selenium Type Library. "Nothing"... l am still trying to figure it out...
 
Upvote 0
Hello Wolf.

Please forgive me for the long reply.
I have found the solution to let chrome work with excel...

If you watch the 15 second video,Error.webm I am having problems to continue the process.
There is an error on: Cells(i, 4) = driver.FindElementByXPath("//*[@id=""root""]/div[1]/div/div[5]/div/div/div[2]/div/div[2]/div[2]/div[8]/div[2]").Text

Only the column "A" & "B" gets filled. After that. The macro stops.

Any help to point me in the right direction...

Thanks again

 
Upvote 0
I tried the code with the same company and it worked for me, see below.
Please try again and tell me if the error persists. Needless to say you must have a stable Internet connection.

autom(AutoRecovered).xlsm
ABCDEFGHI
1Websites Top 100CompanySymbolP/EPriceSales Growth Yr Over YrSales, Revenue, Net Income in B=billion or M=million52-Week Low & High5 Year High & Low
2https://www.msn.com/en-us/money/stockdetails/fi-bjqejc?duration=1DNIO INC.NIO-19,9149,0816.26B / -5.61B55.13 / 13.0113.01 - 55.13
3https://www.msn.com/en-us/money/stockdetails/fi-c3jj2w?duration=1DAMPLITUDE, INC.AMPL-17,0264,33167.26M / -74.98M87.98 / 15.1715.17 - 87.98
(12)


VBA Code:
Public driver As New ChromeDriver
Sub Money()
Dim pt As WebElement, key As New Selenium.Keys, s$, i%
driver.get "https://www.msn.com/en-us/money/stockdetails/fi-bjqejc?duration=1D"
Application.Wait Now + TimeValue("0:00:06")
For i = 2 To 3      ' rows
    MsgBox "Starting " & Cells(i, 3)
    If i > 2 Then driver.SwitchToPreviousWindow
    Set pt = driver.FindElementByXPath("//*[@id=""searchBox""]/input")
    pt.Click
    pt.SendKeys ActiveSheet.Cells(i, 3)
    Application.Wait Now + TimeValue("0:00:06")
    DoEvents
    Set pt = driver.FindElementByCss("#searchBox > span > span > svg")
    pt.Click
    Application.Wait Now + TimeValue("0:00:10")
    DoEvents
    Cells(i, 1) = driver.URL
    Cells(i, 2) = driver.FindElementByCss("#root > div:nth-child(1) > div > div.mainContentLayout-DS-EntryPoint1-1" & _
    " > div > div > div:nth-child(1) > div > div.firstSection-DS-EntryPoint1-1 > div.quoteInfo-DS-EntryPoint1-1" & _
    " > div.title-DS-EntryPoint1-1 > span.displayName-DS-EntryPoint1-1").Text
    Cells(i, 4) = driver.FindElementByXPath("//*[@id=""root""]/div[1]/div/div[5]/div/div/div[2]/div/div[2]/div[2]/div[8]/div[2]").Text
    On Error Resume Next
    ' green
    Set pt = driver.FindElementByCss("#root > div:nth-child(1) > div > div.mainContentLayout-DS-EntryPoint1-1 >" & _
    " div > div > div:nth-child(1) > div > div.secondSection-DS-EntryPoint1-1 > div.priceInfo-DS-EntryPoint1-1" & _
    " > div > div.mainPrice.color_green-DS-EntryPoint1-1")
    If Err.Number = 0 Then
        Cells(i, 5) = pt.Text
    Else
        Cells(i, 5) = driver.FindElementByCss("#root > div:nth-child(1) > div > div.mainContentLayout-DS-EntryPoint1-1 >" & _
        " div > div > div:nth-child(1) > div > div.secondSection-DS-EntryPoint1-1 > div.priceInfo-DS-EntryPoint1-1 > div >" & _
        " div.mainPrice.color_red-DS-EntryPoint1-1").Text
    End If
    On Error GoTo 0
    s = driver.FindElementByXPath("//*[@id=""root""]/div[1]/div/div[5]/div/div/div[2]/div/div[2]/div[1]/div[2]/div/div[3]/span[2]").Text
    s = s & " / " & _
    driver.FindElementByXPath("//*[@id=""root""]/div[1]/div/div[5]/div/div/div[2]/div/div[2]/div[1]/div[2]/div/div[3]/span[1]").Text
    Cells(i, 8) = s
    Cells(i, 10) = driver.FindElementByXPath("//*[@id=""root""]/div[1]/div/div[5]/div/div/div[2]/div/div[2]/div[2]/div[5]/div[2]").Text
    ' 5-year
    driver.FindElementByXPath("//*[@id=""root""]/div[1]/div/div[5]/div/div/div[2]/div/div[1]/div[2]/div/div/button[8]").Click
    Application.Wait Now + TimeValue("0:00:10")
    Cells(i, 9) = driver.FindElementByCss("#root > div:nth-child(1) > div > div.mainContentLayout-DS-EntryPoint1-1 > div >" & _
    " div > div:nth-child(2) > div > div.comparisonTable-DS-EntryPoint1-1 > div > table > tbody > tr.tableLastRow-DS-EntryPoint1-1" & _
    " > td:nth-child(12) > div").Text
    ' analysis
    On Error Resume Next
    Set pt = driver.FindElementByCss("#root > div:nth-child(1) > div > div.mainContentLayout-DS-EntryPoint1-1 > div > div >" & _
    " div:nth-child(1) > div > div.secondSection-DS-EntryPoint1-1 > div.navigation-DS-EntryPoint1-1 > div > div > button:nth-child(5) > span")
    If Err.Number = 0 Then
        pt.Click
    Else
        driver.FindElementByCss("#root > div:nth-child(1) > div > div.mainContentLayout-DS-EntryPoint1-1 > div > div > div:nth-child(1)" & _
        " > div > div.secondSection-DS-EntryPoint1-1 > div.navigation-DS-EntryPoint1-1 > div > div > button:nth-child(2) > span").Click
    End If
    On Error GoTo 0
    Application.Wait Now + TimeValue("0:00:10")
    driver.SwitchToNextWindow
    s = driver.FindElementByXPath _
    ("//*[@id=""main""]/div[2]/div[2]/div[2]/div[3]/div/div/div[5]/div[1]/div[2]/div[1]/div[1]/div[1]/div[2]/div/div[2]/div/ul[2]/li[2]/p").Text
    s = s & " / " & driver.FindElementByXPath _
    ("//*[@id=""main""]/div[2]/div[2]/div[2]/div[3]/div/div/div[5]/div[1]/div[2]/div[1]/div[1]/div[1]/div[2]/div/div[2]/div/ul[3]/li[2]/p").Text
    Cells(i, 7) = s
    Cells(i, 12) = driver.FindElementByXPath("//*[@id=""main""]/div[2]/div[2]/div[2]/div[3]/" & _
    "div/div/div[5]/div[1]/div[2]/div[1]/div[1]/div[1]/div[2]/div/div[2]/div/ul[6]/li[2]/p").Text
    Cells(i, 11) = driver.FindElementByXPath _
    ("//*[@id=""main""]/div[2]/div[2]/div[2]/div[4]/div/div/div[5]/div[1]/div[2]/div[1]/div[1]/div/div/div/ul[1]/li[2]/span[1]/p").Text
    ' growth
    Application.Wait Now + TimeValue("0:00:12")
    Set pt = driver.FindElementByCss _
    ("#main > div.content-div.fullwidth.loaded > div.main-region.maincontainer.fullwidth.stckdtl" _
    & " > div.dynaloadable > div:nth-child(4) > div > div > div.key-stats-area > ul > li:nth-child(2)")
    pt.Click
    Application.Wait Now + TimeValue("0:00:06")
    Cells(i, 6) = driver.FindElementByXPath("//*[@id=""main""]/div[2]/div[2]/div[2]/div[3]/" & _
    "div/div/div[5]/div[1]/div[2]/div[2]/div[1]/div/div/div/ul[1]/li[2]/span[1]/p").Text
    ' company
    driver.FindElementByXPath("//*[@id=""profile""]/a").Click
    Application.Wait Now + TimeValue("0:00:10")
    driver.FindElementByXPath("//*[@id=""main""]/div[2]/div[2]/div[2]/div/div[3]/div/div[2]/div[2]/div/button[1]").Click
    Application.Wait Now + TimeValue("0:00:06")
    Cells(i, 13) = driver.FindElementByXPath("//*[@id=""main""]/div[2]/div[2]/div[2]/div/div[3]/div/div[2]/div[1]").Text
    driver.Close    ' second window
Next
End Sub
 
Upvote 0
Solution
Wolf. A pleasant good morning to you.

I read your comments.

I have a stable internet connection,.

I have scan my computer, uninstall and reinstall office. Chrome and Selenium are installed and up-to-date as well...

Not sure what seems to be the problem...
I have office desktop 2019. Not sure if your version may caused the problem...

What if I used the excel file you have created. Would does make any difference?

Thanks in advance
 
Upvote 0
I tried the code with the same company and it worked for me, see below.
Please try again and tell me if the error persists. Needless to say you must have a stable Internet connection.

autom(AutoRecovered).xlsm
ABCDEFGHI
1Websites Top 100CompanySymbolP/EPriceSales Growth Yr Over YrSales, Revenue, Net Income in B=billion or M=million52-Week Low & High5 Year High & Low
2https://www.msn.com/en-us/money/stockdetails/fi-bjqejc?duration=1DNIO INC.NIO-19,9149,0816.26B / -5.61B55.13 / 13.0113.01 - 55.13
3https://www.msn.com/en-us/money/stockdetails/fi-c3jj2w?duration=1DAMPLITUDE, INC.AMPL-17,0264,33167.26M / -74.98M87.98 / 15.1715.17 - 87.98
(12)


VBA Code:
Public driver As New ChromeDriver
Sub Money()
Dim pt As WebElement, key As New Selenium.Keys, s$, i%
driver.get "https://www.msn.com/en-us/money/stockdetails/fi-bjqejc?duration=1D"
Application.Wait Now + TimeValue("0:00:06")
For i = 2 To 3      ' rows
    MsgBox "Starting " & Cells(i, 3)
    If i > 2 Then driver.SwitchToPreviousWindow
    Set pt = driver.FindElementByXPath("//*[@id=""searchBox""]/input")
    pt.Click
    pt.SendKeys ActiveSheet.Cells(i, 3)
    Application.Wait Now + TimeValue("0:00:06")
    DoEvents
    Set pt = driver.FindElementByCss("#searchBox > span > span > svg")
    pt.Click
    Application.Wait Now + TimeValue("0:00:10")
    DoEvents
    Cells(i, 1) = driver.URL
    Cells(i, 2) = driver.FindElementByCss("#root > div:nth-child(1) > div > div.mainContentLayout-DS-EntryPoint1-1" & _
    " > div > div > div:nth-child(1) > div > div.firstSection-DS-EntryPoint1-1 > div.quoteInfo-DS-EntryPoint1-1" & _
    " > div.title-DS-EntryPoint1-1 > span.displayName-DS-EntryPoint1-1").Text
    Cells(i, 4) = driver.FindElementByXPath("//*[@id=""root""]/div[1]/div/div[5]/div/div/div[2]/div/div[2]/div[2]/div[8]/div[2]").Text
    On Error Resume Next
    ' green
    Set pt = driver.FindElementByCss("#root > div:nth-child(1) > div > div.mainContentLayout-DS-EntryPoint1-1 >" & _
    " div > div > div:nth-child(1) > div > div.secondSection-DS-EntryPoint1-1 > div.priceInfo-DS-EntryPoint1-1" & _
    " > div > div.mainPrice.color_green-DS-EntryPoint1-1")
    If Err.Number = 0 Then
        Cells(i, 5) = pt.Text
    Else
        Cells(i, 5) = driver.FindElementByCss("#root > div:nth-child(1) > div > div.mainContentLayout-DS-EntryPoint1-1 >" & _
        " div > div > div:nth-child(1) > div > div.secondSection-DS-EntryPoint1-1 > div.priceInfo-DS-EntryPoint1-1 > div >" & _
        " div.mainPrice.color_red-DS-EntryPoint1-1").Text
    End If
    On Error GoTo 0
    s = driver.FindElementByXPath("//*[@id=""root""]/div[1]/div/div[5]/div/div/div[2]/div/div[2]/div[1]/div[2]/div/div[3]/span[2]").Text
    s = s & " / " & _
    driver.FindElementByXPath("//*[@id=""root""]/div[1]/div/div[5]/div/div/div[2]/div/div[2]/div[1]/div[2]/div/div[3]/span[1]").Text
    Cells(i, 8) = s
    Cells(i, 10) = driver.FindElementByXPath("//*[@id=""root""]/div[1]/div/div[5]/div/div/div[2]/div/div[2]/div[2]/div[5]/div[2]").Text
    ' 5-year
    driver.FindElementByXPath("//*[@id=""root""]/div[1]/div/div[5]/div/div/div[2]/div/div[1]/div[2]/div/div/button[8]").Click
    Application.Wait Now + TimeValue("0:00:10")
    Cells(i, 9) = driver.FindElementByCss("#root > div:nth-child(1) > div > div.mainContentLayout-DS-EntryPoint1-1 > div >" & _
    " div > div:nth-child(2) > div > div.comparisonTable-DS-EntryPoint1-1 > div > table > tbody > tr.tableLastRow-DS-EntryPoint1-1" & _
    " > td:nth-child(12) > div").Text
    ' analysis
    On Error Resume Next
    Set pt = driver.FindElementByCss("#root > div:nth-child(1) > div > div.mainContentLayout-DS-EntryPoint1-1 > div > div >" & _
    " div:nth-child(1) > div > div.secondSection-DS-EntryPoint1-1 > div.navigation-DS-EntryPoint1-1 > div > div > button:nth-child(5) > span")
    If Err.Number = 0 Then
        pt.Click
    Else
        driver.FindElementByCss("#root > div:nth-child(1) > div > div.mainContentLayout-DS-EntryPoint1-1 > div > div > div:nth-child(1)" & _
        " > div > div.secondSection-DS-EntryPoint1-1 > div.navigation-DS-EntryPoint1-1 > div > div > button:nth-child(2) > span").Click
    End If
    On Error GoTo 0
    Application.Wait Now + TimeValue("0:00:10")
    driver.SwitchToNextWindow
    s = driver.FindElementByXPath _
    ("//*[@id=""main""]/div[2]/div[2]/div[2]/div[3]/div/div/div[5]/div[1]/div[2]/div[1]/div[1]/div[1]/div[2]/div/div[2]/div/ul[2]/li[2]/p").Text
    s = s & " / " & driver.FindElementByXPath _
    ("//*[@id=""main""]/div[2]/div[2]/div[2]/div[3]/div/div/div[5]/div[1]/div[2]/div[1]/div[1]/div[1]/div[2]/div/div[2]/div/ul[3]/li[2]/p").Text
    Cells(i, 7) = s
    Cells(i, 12) = driver.FindElementByXPath("//*[@id=""main""]/div[2]/div[2]/div[2]/div[3]/" & _
    "div/div/div[5]/div[1]/div[2]/div[1]/div[1]/div[1]/div[2]/div/div[2]/div/ul[6]/li[2]/p").Text
    Cells(i, 11) = driver.FindElementByXPath _
    ("//*[@id=""main""]/div[2]/div[2]/div[2]/div[4]/div/div/div[5]/div[1]/div[2]/div[1]/div[1]/div/div/div/ul[1]/li[2]/span[1]/p").Text
    ' growth
    Application.Wait Now + TimeValue("0:00:12")
    Set pt = driver.FindElementByCss _
    ("#main > div.content-div.fullwidth.loaded > div.main-region.maincontainer.fullwidth.stckdtl" _
    & " > div.dynaloadable > div:nth-child(4) > div > div > div.key-stats-area > ul > li:nth-child(2)")
    pt.Click
    Application.Wait Now + TimeValue("0:00:06")
    Cells(i, 6) = driver.FindElementByXPath("//*[@id=""main""]/div[2]/div[2]/div[2]/div[3]/" & _
    "div/div/div[5]/div[1]/div[2]/div[2]/div[1]/div/div/div/ul[1]/li[2]/span[1]/p").Text
    ' company
    driver.FindElementByXPath("//*[@id=""profile""]/a").Click
    Application.Wait Now + TimeValue("0:00:10")
    driver.FindElementByXPath("//*[@id=""main""]/div[2]/div[2]/div[2]/div/div[3]/div/div[2]/div[2]/div/button[1]").Click
    Application.Wait Now + TimeValue("0:00:06")
    Cells(i, 13) = driver.FindElementByXPath("//*[@id=""main""]/div[2]/div[2]/div[2]/div/div[3]/div/div[2]/div[1]").Text
    driver.Close    ' second window
Next
End Sub
Good Wolf. This problem is a pain. I am not sure, if you can point me to someone else who can help me?

Thanks again
 
Upvote 0
There are a few things I can try. If you use different companies, do you always get the same error on the same line?
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,206
Members
453,022
Latest member
RobertV1609

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top