我试图通过xpath找到元素,但经常出现语法错误
它将^标记放在xpath中的冒号之前。在
我在Chrome开发工具中生成xpath。在html中找到元素,右键单击它并选择copyxpath。在C:\>python ebcm_login.py
File "ebcm_login.py", line 47
elem = driver.find_element_by_xpath("//*[@id="j_idt51:j_idt55_body"]/table/tbody/tr/td[2]/table/tbody/tr[6]/td[1]/input")
^
SyntaxError: invalid syntax
C:\>python ebcm_login.py
File "ebcm_login.py", line 48
elem = driver.find_element_by_xpath("//*[@id="menuForm:j_idt57"]/table/tbody/tr/td[2]")
^
SyntaxError: invalid syntax
C:\>python
Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>