我正在尝试单击此页底部的“下一步”按钮:https://www.domcop.com/domains/great-expired-domains/
我尝试过使用.select、xpath和Selenium使用css选择器,但没有任何效果。在
我认为这个按钮是在生成一个JQuery代码来列出同一页面上的域,这将解释python为什么不能用xpath和.select单击它。在
但是,我不知道如何用Selenium点击它。。。在
这是我的剧本:
from selenium import webdriver
driver = webdriver.Firefox()
driver.get("https://www.domcop.com/domains/great-expired-domains/")
assert "Python" in driver.title
link = driver.find_element_by_class_name('next').get_attribute('a')
它返回一个'NoneType'对象。。。在
任何帮助都将不胜感激!在
谢谢你
查找元素(:xpath,'//*[@id=“domcop-table_wrapper”]/div[position()>;1]/div[position()>;1]/div/ul/li[6]/a/i[@class=“icon double angle right”]')
此Xpath始终有效。之后可以向下滚动并单击
我只是没有向下滚动。仅此而已。在
检查此Xpath
参见以下代码:
与常见的XML/HTML解析器不同,selenium模拟浏览器行为,因此它应该不会对JQuery生成的元素产生问题,正如您所担心的那样。选择器的问题是,的元素的not attribute,而是
a
是类为^{next
的子级。因此,您可以在此处为子项>
使用CSS选择器:相关问题 更多 >
编程相关推荐