在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/Python/ python 中的selenium 點擊后匹配報錯

python 中的selenium 點擊后匹配報錯

clipboard.png

  click_link=self.driver.find_element_by_xpath('//form[@id="form"]').click()
                # time.sleep(5)
                link=self.driver.find_element_by_xpath('//form/input[4]/@value')

報錯如下
selenium.common.exceptions.InvalidSelectorException: Message: invalid selector: The result of the xpath expression "http://form/input[4]/@value" is: [object Attr]. It should be an element.
(Session info: headless chrome=66.0.3359.181)

回答
編輯回答
澐染
link=self.driver.find_element_by_xpath('//form/input[4]/@value')

去掉@value,定位到元素就行,不用獲取值

2018年9月16日 16:27