Python+selenium problems encountered

Source: Internet
Author: User

The final code is written:
From selenium import Webdriver

Driver = Webdriver. Chrome ("E:\chromedriver_win32\chromedriver.exe")
Driver.get ("Https://test.tembin.com/oldriver/login")

DRIVER.FIND_ELEMENT_BY_ID ("username"). Clear ()
DRIVER.FIND_ELEMENT_BY_ID ("username"). Send_keys ("XXXX")
driver.find_element_by_id ("password"). Clear ()
driver.find_element_by_id ("password"). Send_keys ("XXX")
Driver.find_element_by_xpath (".//*[@id = ' loginform ']/input"). Click ()
Driver.quit ()
The problem solved:
Q1:
Driver.find_element_by_xpath (".//*[@id = ' loginform ']/input"). Click ()
The problem of positioning, using the Firefox browser to locate

Unresolved issues:

From selenium import Webdriver

Driver = Webdriver. Chrome ("E:\chromedriver_win32\chromedriver.exe")
Driver.get ("Https://test.tembin.com/oldriver/login")

DRIVER.FIND_ELEMENT_BY_ID ("username"). Clear ()
DRIVER.FIND_ELEMENT_BY_ID ("username"). Send_keys ("15682776058")
driver.find_element_by_id ("password"). Clear ()
driver.find_element_by_id ("password"). Send_keys ("000000")
Driver.find_element_by_xpath (".//*[@id = ' loginform ']/input"). Click ()
driver.find_element_by_id ("Go"). Submit ()
Driver.quit ()

Add a line after the error will appear;

Traceback (most recent):
File "e:/py_wrok_space/study_py/6_1.py", line one, in <module>
driver.find_element_by_id ("Go"). Submit ()
File "D:\lib\site-packages\selenium\webdriver\remote\webdriver.py", Line 285, in find_element_by_id
Return Self.find_element (By=by.id, value=id_)
File "D:\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 787, in Find_element
' Value ': value}) [' Value ']
File "D:\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in Execute
Self.error_handler.check_response (response)
File "D:\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 194, in Check_response
Raise Exception_class (message, screen, stacktrace)
Selenium.common.exceptions.NoSuchElementException:Message:no Such element:unable to locate element: {"method": " ID "," selector ":" Go "}
(Session info:chrome=59.0.3071.9)
(Driver info:chromedriver=2.24.417431 (9AEA000394714D2FBB20850021F6204F2256B9CF), platform=windows NT 6.1.7601 SP1 x86_64)

After Google, find the link https://stackoverflow.com/questions/34969208/ Nosuchelementexception-message-unable-to-locate-element-methodlink-text

We'll fix it tomorrow.

Python+selenium problems encountered

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.