Skip to content

Instantly share code, notes, and snippets.

@bobfrankly
Created December 15, 2016 19:44
Show Gist options
  • Save bobfrankly/e954f6cc2d25c78216607508502767d1 to your computer and use it in GitHub Desktop.
Save bobfrankly/e954f6cc2d25c78216607508502767d1 to your computer and use it in GitHub Desktop.
How to use Selenium with PhantomJS and a custom timeout (instead of 60 seconds)
$dllroot = "C:\selenium-dotnet-3.0.0\net35\"
Add-Type -Path (join-path $dllroot Selenium.WebDriverBackedSelenium.dll)
Add-Type -Path (join-path $dllRoot ThoughtWorks.Selenium.Core.dll)
Add-Type -Path (join-path $dllRoot WebDriver.dll)
Add-Type -Path (join-path $dllRoot WebDriver.Support.dll)
$pjsOptions = New-Object OpenQA.Selenium.PhantomJS.PhantomJSOptions # Needs to have an object of this type
$timeout = [timespan]::FromMinutes(12) # Set for 12 minutes
$driver = New-Object OpenQA.Selenium.PhantomJS.PhantomJSDriver -ArgumentList ('C:\scripts\ruckusPollSelenium\',$obj,$timeout)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment