1, can not start the browser, error is as follows:
============================= ERRORS =============================
Traceback (most recent):
File "D:\python_files\eclipse_wrokstation\WinshareWebAotuTest\TestCase\testBookComments.py", line +, in SetUp
Self.driver = Webdriver. Chrome ()
File "D:\Program files\python\python3\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line page, in __init_ _
Desired_capabilities=desired_capabilities)
File "D:\Program files\python\python3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 154, in __init __
Self.start_session (Desired_capabilities, Browser_profile)
File "D:\Program files\python\python3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 243, in Start_ Session
Response = Self.execute (command.new_session, parameters)
File "D:\Program files\python\python3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 312, in Execute
Self.error_handler.check_response (response)
File "D:\Program files\python\python3\lib\site-packages\selenium\webdriver\remote\errorhandler.py", Line 242, in Check_response
Raise Exception_class (message, screen, stacktrace)
Selenium.common.exceptions.WebDriverException:Message:unknown error:unrecognized Blink Revision: a10b9cedb40738cb152f8148ddab4891df876959
(Driver info:chromedriver=2.10.267521,platform=windows NT 6.3 x86_64)
How to resolve:
Webdriver when initializing, specify the path where the browser is located
When declaring Webdriver, add a sentence and run it again:
Path = "C:\Program Files (x86) \google\chrome\application\chromedriver.exe"
Self.driver = Webdriver. Chrome (Executable_path=path)
2. The element cannot be found according to the position:
(1) Possible situation one: because the window of the current browser is switched (the new Jump window).
Workaround: Before positioning, switch the window first
Handles = driver.window_handles # all Windows
print ' * ' *20,handles
For handle in handles:
If Handle!=driver.current_window_handle:
print ' Switch to ', handle
Driver.switch_to_window (handle)
Print Driver.current_window_handle # Printing window Handle--name
Break
(2) Possible situation two: Because the currently positioned IFrame has changed.
Workaround: Before positioning, switch the frame
Driver.switch_to_frame ("Rightframe")
(3) Possible three: run too fast, the page is not fully loaded.
Workaround: Hibernate for 1 seconds (or more seconds) before locating
Time.sleep (1)
Python+selenium frequently asked questions how to solve