Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to Screenshot Servers With SSL Certificate Issues #1

Open
dafthack opened this issue Apr 19, 2017 · 0 comments
Open

Failure to Screenshot Servers With SSL Certificate Issues #1

dafthack opened this issue Apr 19, 2017 · 0 comments

Comments

@dafthack
Copy link
Owner

Currently, PowerWebShot fails to screenshot web servers with SSL issues such as self-signed certificates, or invalid certificates. I believe this is due to the "acceptSslCerts" flag being set to 'false' by PhantomJS. I've tried a number of different options for accepting SSL certs but none seem to be working.

I've tried the following:

  • Passing CLI Args to phantomjs.exe including --ignore-ssl-errors=yes
  • Setting DesiredCapabilities prior to creating the PhantomJS object including ('CapabilityType.ACCEPT_SSL_CERTS', $true)
  • Adding additional capabilities after creating the PhantomJS object.

Adding additional capabilities to a PhantomJSOptions object prior to creating the PhantomJS object appears to set some options correctly but not "acceptSslCerts". For example, in the current code setting ("phantomjs.page.settings.webSecurityEnabled", $false) does actually set that option to false. However trying a number of variations on ignore-ssl-errors doesn't seem to work.

Current Relevant Code:

$SeleniumDriverPath = ".\WebDriver.dll"
Add-Type -path $SeleniumDriverPath
[OpenQA.Selenium.PhantomJS.PhantomJSOptions]$options = New-Object OpenQA.Selenium.PhantomJS.PhantomJSOptions
#$caps = [OpenQA.Selenium.Remote.DesiredCapabilities]::phantomjs()
#$caps.SetCapability('CapabilityType.ACCEPT_SSL_CERTS', $true)
$cli_args = @()
$cli_args +=  "--web-security=no"
$cli_args += "--ignore-ssl-errors=yes"
$options.AddAdditionalCapability("phantomjs.cli.args", $cli_args)
$options.AddAdditionalCapability("phantomjs.page.settings.ignore-ssl-errors", $true)
$options.AddAdditionalCapability("phantomjs.page.settings.webSecurityEnabled", $false)
$options.AddAdditionalCapability("phantomjs.page.settings.userAgent", "Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko")
$phantomjspath = ".\"
$driver = New-Object OpenQA.Selenium.PhantomJS.PhantomJSDriver($phantomjspath, $options)
#$driver = New-Object OpenQA.Selenium.Remote.RemoteWebDriver($uri,$caps)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant