Use python + selenium in windows to open firebox and pythonfirebox

Source: Internet
Author: User

Use python + selenium in windows to open firebox and pythonfirebox

Install selenium through pycharm

1. Configure python and pycharm, open pycharm, click File> Setting> Project Interpreter in the upper left corner, and click Add on the right.

2. In the displayed window, enter selenium, select selenium, and click install package in the lower left corner. The installation is successful, and the version number is displayed on the right.

3. Create a python file and enter the following code to open the Firefox browser:

4.1 after running, the following error occurs:

Selenium. common. exceptions. WebDriverException: Message: 'geckodriver 'executable needs to be in PATH

Information Display geckodriver must be in the path environment variable

The cause of this error is that the firebox browser version on the local machine is relatively high.

Solution:

Download geckodriver at: https://github.com/mozilla/geckodriver/releases

Find the downloaded directory and add the installation path of geckodriver.exe to the path.

4.2 After the preceding method is modified, the following error occurs when the system runs again:

Selenium. common. exceptions. WebDriverException: Message: Unable to find a matching set of capabilities

Information Display: geckodriver and selenium versions are incompatible

My version: selenium3.10.0 geckodriver V0.15.0

4.3 after the change, the system still reports an error (Khan ~)

Selenium. common. exceptions. SessionNotCreatedException: Message: Expected browser binary location, but unable to find binary in default location, no 'moz: firefoxOptions. binary 'capability provided, and no binary flag

It took me a lot of effort to solve this error... No matter how you do it, this error message is still reported. It will not work if you Upgrade Firefox to the highest version. Finally, I re-installed Firefox and added the installation path of Firefox to the path. (The prompt is as follows: multiple paths must be separated by semicolons (;). I do not know the reason for installation or other reasons. I have no file name when installing the D Drive, the file path is D: \ (which may be the cause of my failure). So I created a new directory!

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.