"Selenium+python" a few questions about using Selenium 1

Source: Internet
Author: User
Tags python script

Problem: selenium.common.exceptions.WebDriverException:Message: ' chromedriver ' executable needs to being in PATH. Please see Https://sites.google.com/a/chromium.org/chromedriver/home

Cause: The hint was not added to the PATH environment variable and Webdriver was not found

Solution: Win10 used to add Chromedriver directory to the PATH environment variable, but still reported the same error, after searching, found to put Chromedriver.exe in the same directory as the Python script can run successfully!

Issue: TypeError: ' Webelement ' object is not iterable

Cause: When selecting multiple HTML page elements, you should use the plural of the method

Resolution: Use Find_elements_by_tag_name, here element has s

Issue: Attributeerror: ' Webelement ' object has no attribute ' SendKeys '

Reason: The code is written in SendKeys, but there is no such method (actually Send_keys)

Solution: Change SendKeys to Send_keys (this problem is purely careless = =)

Background: In the use of selenium crawler, you need to enter the keyword search, but there is the opening of the Web page, enter the keyword after the exception is thrown.

Problem: After opening the Web page, throw an exception, then the browser automatically closes

Reason: Debugging found the location of the exception thrown in:

Webdriverwait (driver,15). Until (

Ec.title_contains (Unicode (to_city))

)

This means waiting for the search results page to load the page containing the keyword before proceeding to the next step, but because the previous step entered the To_city value unexpectedly points to the other city name, causing this step to throw an exception cannot continue

"Selenium+python" a few questions about using Selenium 1

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.