@jrenforth I don't know if you posted the wrong code above or the code itself is like that! There are 2 functions named conditionalMail() and the first function is not closed either. Please check your code again. There are too many errors.
I already have thought of that .. but is it the same as chrome driver ..?
Is there a way to deal with just one page while using selenium and ignore other tabs .. this is because when trying to run a code there are other tabs opened (advertisements) and I want to make the desired tab active all the time
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim cellv As Integer
cellv = Cells(2, 7).Value
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
Do While IE.Busy Or _
IE.readyState <> 4
Dim rowElements As Object, rowElement As Object, columnElement As Object
Set rowElements = IE.document.getElementsByClassName("figureTable")(1).getElementsByTagName("tr")
i = 3
For Each rowElement In rowElements
j = 1
For Each columnElement In rowElement.getElementsByTagName("td")
Cells(i, j).Value = columnElement.innerText
j = j + 1
i = i + 1
Set IE = Nothing
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
Thank you. Modified to create TMP folder on the desktop without knowing the path. Posting here for others, should the need arise.
Dim newTmp As String
newTmp = CreateObject("WScript.Shell").SpecialFolders("Desktop")
If Not CreateObject("Scripting.FileSystemObject").FolderExists(newTmp & "\tmp") Then
CreateObject("Scripting.FileSystemObject").CreateFolder (newTmp & "\tmp")
This one doesn't give any error. The css selector was faulty.
Dim driver As New WebDriver
Dim posts As Object, post As Object
driver.Start "Phantomjs", "https://redmart.com"
Set posts = driver.FindElementsByCss("li.productPreview")
For Each post In posts
i = i + 1: Cells(i, 1) = post.FindElementByCss("h4 > a").Text
Cells(i, 2) = post.FindElementByCss("span[class^=ProductPrice]").Text
Cells(i, 3) = post.FindElementByCss("img.showImage").Attribute("src")
Hi @elfrom I tried this but there's an issue with the library which is throwing an error out of stack space if nested levels are more than 3. I'll keep trying to find any workaround and let you know if I find something. And yes this is one complicated recursion!