问题描述
我想选择 li 下拉菜单来点击 enter image description here
driver.find_element((By.XPATH,"//li[@class='ellipsis1']")).click()
错误:
selenium.common.exceptions.invalidargumentexception:消息:无效 参数:'using' 必须是字符串
然后我将代码更改为
driver.find_element(By.XPATH,"//li[@class='ellipsis1']").click()
错误:
selenium.common.exceptions.NoSuchElementException:消息:没有这样的 元素:无法定位元素: {"method":"xpath","selector":"//li[@class='ellipsis1']"}
我该怎么办?
解决方法
尝试使用那个:
driver.find_element(By.XPATH,"//li[@class='ellipsis1 selectbox-item(1)']").click()
或
driver.find_element(By.XPATH,"//li[contains(@class,'ellipsis1')][1]").click()