加载网站后,我成功单击一个按钮,该按钮将在此类中生成一些数字
<div class="styles__Value-sc-1bfbyy7-2 eVmhyz"></div>
但不是马上,它会把它们一个接一个地放进去。Selenium将立即获取放入类中的第一个值,但不会等待添加其他值。任何方法都可以等待它在抓取之前加载其中的所有值
以下是我用于获取值的python代码:
total = driver.find_element_by_xpath("//div[@class='styles__Value-sc-1bfbyy7-2 eVmhyz']").text
硒有一种
WebDriverWait
方法:我还没有在本地测试过它,但它可能会工作。还有
presence_of_all_elements_located
方法,您可以在this页面上找到详细信息希望这有帮助
相关问题 更多 >
编程相关推荐