[COLOR=#BBC0C4 !important][COLOR=#6A737C !important]0
<button class="js-vote-down-btn grid--cell s-btn s-btn__unset c-pointer" title="This question does not show any research effort; it is unclear or not useful" aria-pressed="false" aria-label="down vote" data-selected-classes="fc-theme-primary" style="margin: 2px; box-sizing: inherit; font: inherit; position: relative; padding: 0px; border-width: initial; border-style: none; border-color: initial; border-radius: 3px; background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; outline: none; box-shadow: none;">
[/COLOR]
I am newbie and just try to finish my homework. I am trying to get the symbol, companyname, stock price from className by using VBA-Selenium in this website
https://www.barchart.com/stocks/ind...&orderBy=lastPrice&orderDir=asc&viewName=main
but I am still getting the error
"Run time error '438'object doesn't support this property or method" with the line of code mysheet.Cells(i, 1).Value = mytables.FindElementByClass("symbol text-left").Text. How should I resolve this problem? I already tried to install new patch of Selenium but it was not working.
There is another problem, that this page has 20 pages and I have to click each page to take the stock price. How can I do this? Please help this poor student.
Here is my code
[Public Sub Russelcrawler()
Dim driver As New WebDriver
Dim mytables As WebElements, table As WebElement, i As Integer, mysheet As Worksheet
With driver
.Start "IE", "https://www.barchart.com/stocks/indices/russell/russell2000?page=20&orderBy=lastPrice&orderDir=asc&viewName=main"
.Get "/"
End With
Set mysheet = Sheets("Russel")
Set mytables = driver.FindElementsByClass("bc-datatable")
i = 2
For Each table In mytables
mysheet.Cells(i, 1).Value = mytables.FindElementByClass("symbol text-left").Text
mysheet.Cells(i, 2).Value = mytables.FindElementByClass("symbolName text-left").Text
mysheet.Cells(i, 3).Value = mytables.FindElementByClass("lastPrice").Text
i = i + 1
Next
End Sub]
<button class="js-vote-down-btn grid--cell s-btn s-btn__unset c-pointer" title="This question does not show any research effort; it is unclear or not useful" aria-pressed="false" aria-label="down vote" data-selected-classes="fc-theme-primary" style="margin: 2px; box-sizing: inherit; font: inherit; position: relative; padding: 0px; border-width: initial; border-style: none; border-color: initial; border-radius: 3px; background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; outline: none; box-shadow: none;">
<svg aria-hidden="true" class="svg-icon m0 iconArrowDownLg" width="36" height="36" viewBox="0 0 36 36">
</path></svg>
</button><button class="js-favorite-btn s-btn s-btn__unset c-pointer py8" aria-pressed="false" aria-label="favorite" data-selected-classes="fc-yellow-600" title="Click to mark as favorite question (click again to undo)" style="margin: 0px; box-sizing: inherit; font: inherit; padding: 0px; position: relative; border-width: initial; border-style: none; border-color: initial; border-radius: 3px; background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; outline: none; box-shadow: none;"></path></svg>
<svg aria-hidden="true" class="svg-icon iconStar" width="18" height="18" viewBox="0 0 18 18">
</path></svg>
</button>[/COLOR]</path></svg>
[/COLOR]
I am newbie and just try to finish my homework. I am trying to get the symbol, companyname, stock price from className by using VBA-Selenium in this website
https://www.barchart.com/stocks/ind...&orderBy=lastPrice&orderDir=asc&viewName=main
but I am still getting the error
"Run time error '438'object doesn't support this property or method" with the line of code mysheet.Cells(i, 1).Value = mytables.FindElementByClass("symbol text-left").Text. How should I resolve this problem? I already tried to install new patch of Selenium but it was not working.
There is another problem, that this page has 20 pages and I have to click each page to take the stock price. How can I do this? Please help this poor student.
Here is my code
[Public Sub Russelcrawler()
Dim driver As New WebDriver
Dim mytables As WebElements, table As WebElement, i As Integer, mysheet As Worksheet
With driver
.Start "IE", "https://www.barchart.com/stocks/indices/russell/russell2000?page=20&orderBy=lastPrice&orderDir=asc&viewName=main"
.Get "/"
End With
Set mysheet = Sheets("Russel")
Set mytables = driver.FindElementsByClass("bc-datatable")
i = 2
For Each table In mytables
mysheet.Cells(i, 1).Value = mytables.FindElementByClass("symbol text-left").Text
mysheet.Cells(i, 2).Value = mytables.FindElementByClass("symbolName text-left").Text
mysheet.Cells(i, 3).Value = mytables.FindElementByClass("lastPrice").Text
i = i + 1
Next
End Sub]