November 18, 2020
I trying to get data from table. I'm using Selenium.ChromeDriver. XPath print it out like this //*[@id="foundCompanies"]/tbody/tr/td[2]. I try to follow this tutorial
Web Scraping – Filling in Forms
,for my own purpose.
Also I need timer to send request 10 second interval.
Thank You.
November 18, 2020
There were also 2 attachments in that post, but they seem to be missing / deleted. The problem is when I try to run that vba file, the Chrome window just flashes and it doesn't get data out of the table.
From the first page (table), it should click on the Business ID. Then a new page(table) opens and i want data from that table to columns B,C,D etc. I hope those attachments clarify the situation.
November 18, 2020
Okay. I got it yesterday to act like a blog text. The only pity I have anymore is how do I make it work so that if the information in column A is not
found on the search site, it would start over.
There are now many points where it can find the error, but I would like that when it notices the error write what it already found, otherwise print null.
I would be grateful if someone could help.
Maybe this is the wrong forum to askhelp, but when the original code was found here I thought I would ask for help here.
This is a school project for which I need that data. All the data I tried to request (csv or excel) is chargeable, hence this webscraping.
There are over 35,000 rows that should run through this. LoL.
October 5, 2010
Hi Hannu,
When the search returned nothing, a pop-up was created in the Chrome browser - didn't you see this?
Because your code was looking for elements on the main page/window rather than dealing with the pop-up, this was causing the error.
I've added a section that checks for the error generated by trying to click an element when the pop-up is visible.
On Error Resume Next
Driver.Wait 2000
Driver.FindElementById("_ctl0_cphSisalto_rptHakuTulos__ctl1_HyperLink1").Click
If Err.Number > 0 Then
Driver.SwitchToAlert.Accept
Else
Driver.Wait 1000
Range("B" & count) = Driver.FindElementById("_ctl0_cphSisalto_lblytunnus").Text
Range("C" & count) = Driver.FindElementById("_ctl0_cphSisalto_lblYrityksenKotipaikka").Text
Range("D" & count) = Driver.FindElementById("_ctl0_cphSisalto_lblToiminimi").Text
Range("E" & count) = Driver.FindElementById("_ctl0_cphSisalto_lblYrityksenToimiala").Text
End If
On Error GoTo 0
So if this pop-up is there, the code will now dismiss it and then move on to the next search. See attached file.
Regards
Phil
1 Guest(s)