I am trying to data scrape from a website that is only compatible with Google Chrome. I want to scrape the info into an Excel file so I would like to use VBA to accomplish this.
This is my code.
Sub OpenGoogleChrome()
Dim driver As New WebDriver
driver.Start "chrome", "http://www.google.com"
driver.Get "/"
End Sub
I've tried several variations of this code but I get the same error:
I am just simply trying to open chrome through this automation process so I can utilize it to data scrape later.
I am using Chrome v69, the most recent version of Selenium Basic (2.0.9.0) and I've replaced the Selenium Basic ChromeDriver with the latest version (2.42).
These are my VBA references for my code:
Any help would be much appreciated.
EDIT: I'm using Windows 10 and I do have the necessary .Net framework.
SeleniumBasic requires .NET Framework 3.5. I had the same problem once and activating it on Turn Windows features on and off dialog solved the problem. It worth the try
I faced this error as well, but solved it after I install Selenium via administrator mode.
Related
I am using Selenium Basic to automate MS Edge.
I would like to be able to open a url on MS Edge using IE Mode. I found that there is an IEDriverServer.exe that we can use to run urls on MS Edge IE Mode but there is no example how to use it on VBA.
Can someone help me how to properly put it in my code?
Dim driver As New WebDriver
Set driver = New EdgeDriver
driver.Get ("https://google.com")
driver.Refresh
Thanks.
Please refer to https://github.com/florentbr/SeleniumBasic/releases/tag/v2.0.9.0
Once you install Selenium Basic exe on your machine, you will get lot of ready examples with vbscript at installation location.
Also make sure to download latest edge driver and put in installation location by renaming as previous.
Sample code
Set driver = CreateObject("Selenium.EdgeDriver")
driver.Get "edge://settings/defaultBrowser"
driver.Window.Maximize
driver.FindElementByXPath(....<add xpath here>...)
' add required UI component action & xpath for the same.
driver.Quit
I am trying to download files by clicking a button. This works fine as long as my ChromeDriver is not in headless mode. Once I tested the macro with ChromeDriver in headless mode, I realized that nothing was being downloaded. I researched the issue and found out that it was a security measure. There are suggested work-arounds for Python, however I was not able to translate the code into VBA. I am using SeleniumBasic.
What I want is to be able to download files to the Environ("userprofile") & "\Downloads\" folder once I click a download button, just like I do when the browser is not in headless mode. Thank you all in advance.
Notes:
I call the driver in headless mode using driver.AddArgument "--headless"
I could not provide the URL I am using as this is a long macro requiring login etc. but as far as I understand, the issue should be reproducible in any download scenario involving a headless ChromeDriver.
I am using the most recent SeleniumBasic v2.0.9.0 and the ChromeDriver version 75.0.3770.140
I have a question regarding Selenium and the current Microsoft updates:
I just installed the newest Microsoft patches on a PC and now the Selenium scripts won't work anymore. I'm using the Selenium IE Driver 2.44.0 in the scripts. Maybe something has changed in the Internet Explorer, I'm not sure. Suddenly the scripts can't find any web elements on the page anymore. An InvalidSelectorException is thrown because the findElements methods can't be executed. The IE driver opens up and it navigates to the given URL, but when it tries to find a web element, the script fails. I also tried it out on a PC which hasn't the newest updates installed yet and the scripts are working fine there, there are no problems at all.
Do you have any ideas what to do or what could be the cause?
Thanks a lot!
Yes as I stated here
If you have taken windows update KB3025390 IE will not work as expected. There is currently no resolution to that yet.
Also, Uninstalling the update KB3025390 should make the WebDriver work correctly with Internet Explorer 11. See this answer
I am using 32bit IE Webdriver and Selenium 2.0 and IE9 (VS2010 vb.net Test project) Is it possible to pass Accept to Word documents Print screen which is invoked by javascript. Surprisingly it is not an Alert nor a Modal so i cannot access using WindowsHandle nor Alert. I am newbie to this can anyone help?
Thanks,
Gauls
I think you can use AutoIT tool, I was searching and got this - may be it help you:
link
I have the same Firefox 8 upload issue with Selenium as described here: Selenium IDE 1.4.1 throwing security error when uploading a local file
The solution to the problem is to edit the atoms.js file, which I can do for Selenium IDE.
However, I'm also using Selenium RC, and want to know how to do the equivalent thing there.
I'm running Ubuntu 10.
Thanks.
Found the atoms.js file.
It's here:
http://groups.google.com/group/selenium-users/browse_thread/thread/f09fbab515806073
Happy times.