![]() |
|
FAO VBA Chrome Selenium Guru's - Printable Version +- WBAUnofficial (https://wbaunofficial.org.uk) +-- Forum: WBAUnofficial (https://wbaunofficial.org.uk/forumdisplay.php?fid=3) +--- Forum: WBAUnofficial (https://wbaunofficial.org.uk/forumdisplay.php?fid=4) +--- Thread: FAO VBA Chrome Selenium Guru's (/showthread.php?tid=26541) Pages:
1
2
|
FAO VBA Chrome Selenium Guru's - Fulham Fallout - 09-08-2022 I wonder if you can help me please. I'm trying to write a bit of VBS code in Excel to populate web forms The website is similar to this one with a login and then I want to be able to send private messages I have to use the Shell function to be able to by-pass the login screen (once already logged on to the site) Where I am stuck, is with the webpage opened, how do I continue the code to enter data into the subject box etc? I can see the box name is "subject" but it's the code to find it I am lost with. Dim driver As New selenium.ChromeDriver Dim ChromeLocation As String Dim MyURL As String Dim ws1 As Worksheet Dim lastRow As Long Range("A1").Select 'This contains the URLs. Using user Supamart as an example, the URL to send him a PM is https://wbaunofficial.org.uk/private.php?action=send&uid=304 and that is located in cell A1 Dim ws1 As Worksheet Dim lastRow As Long Range("A1").Select lastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row Set ws1 = Sheets("rawdata") ChromeLocation = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" 'Location of Chrome.exe in your PC For i = 1 To lastRow MyURL = ws1.Cells(i, 1) lastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row Set ws1 = Sheets("rawdata") ChromeLocation = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" 'Location of Chrome.exe in your PC For i = 1 To lastRow MyURL = ws1.Cells(i, 1) *************************** I know code to use if I was using the following commands Sub TestSelenium() Set cd = New selenium.ChromeDriver cd.Start cd.Get "https://www.wbaunofficial.org.uk" But that will take me to the login page and trying to locate the login button is a nightmare with no name, id, etc etc So... is there a way I can use the shell function as above (once logged in) and the top code runs, opens the message page and then enters the subject and message content from cells b1 & c1? Thanking you in advance. RE: FAO VBA Chrome Selenium Guru's - waffle - 09-08-2022 A = driver.findelementbyclassname(‘input box class name’) A.send_keys(‘hello’) Something like that anyway. I’ve tended to use python rather than vb RE: FAO VBA Chrome Selenium Guru's - Old Stroller - 09-08-2022 (09-08-2022, 04:54 PM)Fulham Fallout Wrote: I wonder if you can help me please. I'll bet you do. ![]() Can't help with the technical stuff though, sorry. RE: FAO VBA Chrome Selenium Guru's - SophLad - 09-08-2022 (09-08-2022, 06:14 PM)Old Stroller Wrote:(09-08-2022, 04:54 PM)Fulham Fallout Wrote: I wonder if you can help me please.
RE: FAO VBA Chrome Selenium Guru's - Fulham Fallout - 09-09-2022 (09-08-2022, 06:14 PM)Old Stroller Wrote:(09-08-2022, 04:54 PM)Fulham Fallout Wrote: I wonder if you can help me please. You have a PM. Sent by a macro course ![]() (09-08-2022, 05:53 PM)waffle Wrote: A = driver.findelementbyclassname(‘input box class name’) Hi Thanks for that. I eventually discovered that shell opening websites in VBA are not the active page and I therefore was unable to populate the form. I removed the shell function and called each url listed in the spreadsheet and it now works a treat. I've learnt quite a bit coding this including website HTML structure and all the different ways of locating web elements. Thanks again for your suggestion RE: FAO VBA Chrome Selenium Guru's - SophLad - 09-09-2022 Is this basically about scraper bots and spamming? RE: FAO VBA Chrome Selenium Guru's - Fulham Fallout - 09-09-2022 (09-09-2022, 11:46 AM)SophLad Wrote: Is this basically about scraper bots and spamming? Are you interested in new kitchen units with hob and oven for £500? I phoned those fuckers a few times to waste their time. RE: FAO VBA Chrome Selenium Guru's - Fulham Fallout - 02-16-2023 (09-08-2022, 05:53 PM)waffle Wrote: A = driver.findelementbyclassname(‘input box class name’) I managed to suss the vba code in the end. Then had to trash it as the person i wrote it for doesn't use windows!!! FFS!!!!! So, I ended up using Python with PyCharm as the console to re-create it and then expanded it more and more. What a fantastic piece of software Python is. RE: FAO VBA Chrome Selenium Guru's - Calgary_Baggie - 02-16-2023 I've seen Python but not used it. Languages I have coded in: C++ C# RPG400/LE MsSQL (stored procs) COBOL Javascript (react) PHP Pascal All completely boring. RE: FAO VBA Chrome Selenium Guru's - Tom Joad - 02-16-2023 Calgary_Baggie Wrote:I've seen Python but not used it. What were you expecting, Goodfellas, Apocalypse Now?
|