1

I am looping through a list of local .HTM webpages using SeleniumBasic version 2.0.6.0. in Excel 2013 VBA. I want to parse the website for information.

EDIT: I use Selenium with FireFox v44.0b1

Sometimes, not always, a pop-up like this appears and the code stops and waits for "user input":

enter image description here

Is there a way to automate VBA or Selenium (or somehow the browser) so that it will click "Yes" every time thi pop-up appears?

JIST
  • 1,139
  • 2
  • 8
  • 30
user3185735
  • 223
  • 5
  • 20

2 Answers2

0

Cookie settings are client dependent. Bypassing these would be flagged as malware by most antivirus programs, as you are explicitly going around the end users settings. I won't get into the ethics of that action- If you're just talking about turning off those notices for your computer, specifically, you could just follow this guide: https://support.microsoft.com/en-us/kb/196955

  • thank you for your reply. My appologies, I forgot to mention that I use FireFoxDriver and not Internet Explorer – user3185735 Dec 30 '15 at 17:02
  • 1
    This is also probably helpful to you: http://stackoverflow.com/questions/18106588/how-to-disable-cookies-using-webdriver-for-chrome-and-firefox-java – Gray Hogan Dec 30 '15 at 17:05
0

Got it! Selenium never opened my default profile but opened another instance which had the "default" FireFox configuration. So by selecting an already configured browser which accepts coockies automatically the problem will be solved.

NOTE! that if you have an instance of the browser opened, Selenium won't open a new one. It will only work if you close all opened browser instances of the selected profile.

Dim driver As New Selenium.FirefoxDriver
driver.SetProfile "Selenium"  'Firefox only. Profile created by running "..\firefox.exe -p"
driver.Get "http://www.google.com"
...

or

Dim driver As New Selenium.FirefoxDriver
driver.SetProfile "C:\MyProfil"   'For Chrome and Firefox only
driver.Get "http://www.google.com"
...
user3185735
  • 223
  • 5
  • 20