【发布时间】:2020-11-16 17:23:38
【问题描述】:
我想在 python 中使用 selenium 模块点击 mt4 web terminal 中的“新订单”图标
这是代码:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Chrome('./chromedriver')
driver.get("https://www.mql5.com/en/trading")
new_order = driver.find_element_by_xpath('/html/body/div[3]/div[1]/a[1]/span[1]')
new_order.click()
这是我得到的错误:
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"/html/body/div[3]/div[1]/a[1]/span[1]"}
(Session info: chrome=86.0.4240.198)
找到该按钮的正确方法是什么,我搜索并找到了一些定位硒元素的方法,但我无法让它们中的任何一个对我有用。
【问题讨论】:
标签: python python-3.x selenium