The highlighting of the table is disabled because this page uses the compatibility mode of Internet Explore

Corried

Board Regular
Joined
Dec 19, 2019
Messages
217
Office Version
  1. 2019
Platform
  1. Windows
  2. Web
Hello Excel Pros, around the World.

I have a problem>

I am trying to login my portfolio by signing my email and password to access data tables from in investing.com website.

I created a short video that shows my current problem. If you are open in helping me. It would be greatly appreciated.


In video time 1:39, a yellow bar indicates "The highlighting of the table is disabled because this page uses the compatibility mode of Internet Explorer". you will also find that the web page does not display properly.

Base the information provided.

How can I work around this?


Thanks in advance

Cheers

https://drive.google.com/file/d/1nywatn ... sp = sharing
 
  • I was able to complete a successful run of the code below, transferring 900 rows of data to the worksheet.
  • However, it frequently errors out on a random tab, failing to load the technical table. I believe this is caused by Internet connection instability, as the issue is not reproducible.
  • Maybe we should transfer 10 tabs at a time, what do you think?
  • I inserted a message box so the user can have an idea of where the code is…

VBA Code:
Public driver As New ChromeDriver

Sub Corr()
Dim pt As WebElement, i%, tx$, j%, k%, tabs, L%, lr%, col As Object, nm$
Sheets("table").Activate                                                    ' sheet to receive data
Cells.ClearContents                                                         ' Clear sheet <===
driver.get "https://www.investing.com/portfolio/"
Application.Wait Now + TimeValue("0:00:04")
Set pt = driver.FindElementByXPath("//*[@id=""loginFormUser_email""]").SendKeys(CStr(Sheets("test").[a85]))
Set pt = driver.FindElementByXPath("//*[@id=""loginForm_password""]").SendKeys(CStr(Sheets("test").[a86]))
Set pt = driver.FindElementByXPath("//*[@id=""signup""]/a")
pt.Click
Application.Wait Now + TimeValue("0:00:03")
Set pt = driver.FindElementByXPath("//*[@id=""navMenu""]/ul/li[9]/a")
pt.Click: DoEvents
Application.Wait Now + TimeValue("0:00:03")
Set col = driver.FindElementsByClass("js-portfolio-tab-wrapper")
DoEvents
For L = 1 To col.Count
    nm = CStr(col.item(L).FindElementsByTag("div").item(1).FindElementsByTag("input").item(1).Value)
    If Len(nm) = 3 Then
        lr = Range("a" & Rows.Count).End(xlUp).row + 2
        Set pt = col.item(L)
        DoEvents: pt.ScrollIntoView
        pt.Click: DoEvents
        Application.Wait Now + TimeValue("0:00:03")
        Set pt = driver.FindElementByXPath("//*[@id=""technical""]/a"): DoEvents
        Application.Wait Now + TimeValue("0:00:04"): DoEvents
        pt.Click: DoEvents
        Application.Wait Now + TimeValue("0:00:04"): DoEvents
        Set pt = driver.FindElementById("sortable")
        j = 1
        For i = 1 To pt.FindElementsByTag("tr")(1).FindElementsByTag("th").Count    ' table header
            Cells(lr, j) = pt.FindElementsByTag("tr")(1).FindElementsByTag("th")(i).Text
            j = j + 1
        Next
        For i = 2 To pt.FindElementsByTag("tr").Count                               ' table rows
            j = 1
            For k = 1 To pt.FindElementsByTag("tr")(i).FindElementsByTag("td").Count    ' columns
                Cells(i + lr, j) = pt.FindElementsByTag("tr")(i).FindElementsByTag("td")(k).Text
                j = j + 1
            Next
        Next
        MsgBox nm & " tranferred."
    End If
Next
For i = Cells(3, Columns.Count).End(xlToLeft).Column To 1 Step -1               ' delete empty columns
    If WorksheetFunction.CountA(Columns(i)) = 0 Then Columns(i).Delete Shift:=xlToLeft
Next
End Sub
 
Upvote 0

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
  • I was able to complete a successful run of the code below, transferring 900 rows of data to the worksheet.
  • However, it frequently errors out on a random tab, failing to load the technical table. I believe this is caused by Internet connection instability, as the issue is not reproducible.
  • Maybe we should transfer 10 tabs at a time, what do you think?
  • I inserted a message box so the user can have an idea of where the code is…
Hello Worf. Thanks for your reply. I am not sure on my end. I only got one error message and only one tab have been loaded into excel.

As you mention: "Maybe we should transfer 10 tabs at a time, what do you think?" I am thinking to transfer or merge two tabs of data as one.

Example: I currently have 30 tabs on investing.com website. If I transfer 15 tabs of data into the other 15 tabs or 2 data series into one tab. How can the code work?

Would it help with the errors? Please let me know how do you want me to proceed?

Thanks in advance
error 10.PNG
Error 10 #2.PNG

Aud.PNG
 
Upvote 0
It is the same error I got, maybe caused by changes in the DOM structure due to page refreshing.

It is dinner time again, so I will return tomorrow…
 
Upvote 0
Lol. It's 8:29 Pm on my side I am going to have dinner as well. Will chat tomorrow please God. Thanks.
 
Upvote 0
This one works for me:

VBA Code:
Public driver As New ChromeDriver

Sub Corr()
Dim pt As WebElement, i%, tx$, j%, k%, tabs, L%, lr%, col As Object, nm$, c%, d%
Sheets("table").Activate                                                    ' sheet to receive data
Cells.ClearContents                                                         ' Clear sheet <===
driver.get "https://www.investing.com/portfolio/"
Application.Wait Now + TimeValue("0:00:04")
Set pt = driver.FindElementByXPath("//*[@id=""loginFormUser_email""]").SendKeys(CStr(Sheets("test").[a85]))
Set pt = driver.FindElementByXPath("//*[@id=""loginForm_password""]").SendKeys(CStr(Sheets("test").[a86]))
Set pt = driver.FindElementByXPath("//*[@id=""signup""]/a")
pt.Click
Application.Wait Now + TimeValue("0:00:03")
Set pt = driver.FindElementByXPath("//*[@id=""navMenu""]/ul/li[9]/a")
pt.Click: DoEvents
Application.Wait Now + TimeValue("0:00:03")
Set col = driver.FindElementsByClass("js-portfolio-tab-wrapper")
DoEvents
For L = 1 To col.Count
    For d = 1 To 10                                                         ' repeat if technical is lost
        nm = CStr(col.item(L).FindElementsByTag("div").item(1).FindElementsByTag("input").item(1).Value)
        If Len(nm) = 3 Then
            lr = Range("a" & Rows.Count).End(xlUp).row + 2
            Set pt = col.item(L)
            DoEvents: pt.ScrollIntoView
            pt.Click: DoEvents
            Application.Wait Now + TimeValue("0:00:03")
            Set pt = driver.FindElementByXPath("//*[@id=""technical""]/a")
            pt.WaitEnabled
            pt.Click: DoEvents
            driver.Wait (500)
            On Error Resume Next
            For c = 1 To 20
            pt.Click
            Set pt = Nothing
            Set pt = driver.FindElementById("sortable")
            If Err.Number = 0 Then Exit For
            Next
            Err.Clear
            j = 1
            For i = 1 To pt.FindElementsByTag("tr")(1).FindElementsByTag("th").Count    ' table header
                Cells(lr, j) = pt.FindElementsByTag("tr")(1).FindElementsByTag("th")(i).Text
                j = j + 1
            Next
            For i = 2 To pt.FindElementsByTag("tr").Count                               ' table rows
                j = 1
                For k = 1 To pt.FindElementsByTag("tr")(i).FindElementsByTag("td").Count    ' columns
                    Cells(i + lr, j) = pt.FindElementsByTag("tr")(i).FindElementsByTag("td")(k).Text
                    j = j + 1
                Next
            Next
            If Err.Number = 0 Then Exit For
        End If
    Next
Next
For i = Cells(3, Columns.Count).End(xlToLeft).Column To 1 Step -1               ' delete empty columns
    If WorksheetFunction.CountA(Columns(i)) = 0 Then Columns(i).Delete Shift:=xlToLeft
Next
End Sub
 
Upvote 0

Words can not explain How I Really appreciate your love, your passion, your commitment, your patience, your diligent and your support with helping me and those before me and after.

I have read other excel forums and many have said, This can not be done. But... You have prove it.

Thank you again for your time.

I know dinner is soon.

Take care of yourself
 
Upvote 0
It is good to be nominated in the category Oscar for best Excel/Chrome Automation… :cool:

Tell me if this thing stops working.

Dinner time!
 
Upvote 0
It is good to be nominated in the category Oscar for best Excel/Chrome Automation… :cool:

Tell me if this thing stops working.

Dinner time!
Lol. That's not a problem. Thanks
 
Upvote 0
Good Night Work. How's dinner...

The last time you have help me on this forum. I don't know what have happen. I am currently getting an error on my excel file and as a result I cannot get the website opened. Please review the short video link if you are willing in helping me.


Thanks in advance

Corried
 
Upvote 0
Hi


Apparently, the Chrome driver version you are using is incompatible with the installed Chrome browser version.

Check the instructions at post #4 of the thread below.

 
Upvote 0

Forum statistics

Threads
1,214,522
Messages
6,120,020
Members
448,939
Latest member
Leon Leenders

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