K
K
kisoluck2016-05-25 19:40:12
Python
kisoluck, 2016-05-25 19:40:12

How to open https sites without trusted certificate without manual confirmation in firefox or phantomjs?

I am writing a script to simulate certain actions on a site with https without a trusted certificate. I use selenium+python+phantomjs/Firefox. PhantomJS doesn't want to render some https pages at all. Firefox throws an error, at best you have to manually acknowledge the exception.
Googled the solution to the problem, the proposed options did not help. Tell me how to be.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeniy _, 2016-05-25
@GeneD88

from selenium import webdriver

profile = webdriver.FirefoxProfile()
profile.accept_untrusted_certs = True

driver = webdriver.Firefox(firefox_profile=profile)

from selenium import webdriver

options = webdriver.ChromeOptions()
options.add_argument('--ignore-certificate-errors')

driver = webdriver.Chrome(chrome_options=options)

webdriver.PhantomJS("phantomjs", service_args=['--ignore-ssl-errors=true'])

A
Alexey Sundukov, 2016-05-26
@alekciy

You need to run PhantonJS with the option --ignore-ssl-errors=true Command Line Interface and it works and solves the problem (if the problem is with the certificate, of course). The fact that this is done through the options of the python driver itself does not mean at all that it starts PhantonJS with this option (you can usually check it through strace). I would recommend running PhantomJS from the command line with your hands and connecting from python to it.
I can’t say for Firefox right off the bat, but I suspect that it will be more difficult to do it there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question