3

I have just spent hours stuck on Selenium with Safari before figuring out that I needed to disable popup blocker to allow a login popup that I have.

My question is, is there a way to disable the popup blocker when creating a node/webdriver with Selenium Grid 2, or when creating a RemoteWebDriver in code, or both?

Otherwise, I have to manually remember to change this setting by opening the browser myself. The aim is to have Selenium running across several machines so it would be great to be able to set this programatically.

DevDave
  • 6,700
  • 12
  • 65
  • 99

1 Answers1

0

Ok, here's the AppleScript that I ended up writing:

tell application "System Events" to tell process "Safari"
    set frontmost to true
    keystroke "," using {command down}  -- open preferences
    delay 1
    tell window "Security"
        tell group 1
            tell group 1
                click checkbox "Block pop-up windows"
            end tell
        end tell
        key code 53  -- close preferences
    end tell
end tell

if you save it as popup.as you can run it like this:

$ osascript popup.as

Keep in mind that this only works locally, not on a cloud service like Sauce Labs.

elaichi
  • 508
  • 5
  • 7