python - I don't know how to use statement driver.find_element(By.LINK_TEXT, -
i tried writing
driver.find_element(by.link_text, value='10').click()
and following command line feedback:
uname = driver.find_element(by.link_text, '10').click() file "c:\python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", l ine 680, in find_element {'using': by, 'value': value})['value'] file "c:\python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", l ine 165, in execute self.error_handler.check_response(response) file "c:\python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py" , line 164, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.nosuchelementexception: message: u'no such element\n (session info: chrome=28.0.1500.95)\n (driver info: chromedriver=2.2,platform= windows nt 6.1 sp1 x86_64)'
other permutations of statement produce similar looking feedback. (the '10' i'm writing link page, e.g., "1 2 3 4 5 6 7 8 9 10 ...")
i'm trying go page 10. don't know how. getting line 2 start i'd contented with.
thanks help.
update:
if write driver.find_element_by_link_text('10').click()
feedback:
uname = driver.find_element_by_link_text('10').click() file "c:\python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", l ine 246, in find_element_by_link_text return self.find_element(by=by.link_text, value=link_text) file "c:\python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", l ine 680, in find_element {'using': by, 'value': value})['value'] file "c:\python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", l ine 165, in execute self.error_handler.check_response(response) file "c:\python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py" , line 164, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.nosuchelementexception: message: u'no such element\n (session info: chrome=28.0.1500.95)\n (driver info: chromedriver=2.2,platform= windows nt 6.1 sp1 x86_64)'
update ii: code have work from:
import time import win32ui import win32api import win32con selenium import webdriver selenium.webdriver.common.keys import keys ctypes import * selenium.webdriver.common.by import driver = webdriver.chrome() driver.get('http://[site]');
try this:
driver.find_element_by_link_text('10').click()
Comments
Post a Comment