[英]How i can click on a div with role button without text? Using Python Selenium
This is the html code exemple:这是 html 代码示例:
<div aria-label="Continue" class="my-class" data-visualcompletion="ignore"></div>
<div class="div1-class">
<div class="div1-class2">
<span class="area-span" dir="auto">
<span class="text-span">Continue</span>
</span>
</div>
</div>
<div class="div2-class" data-visualcompletion="ignore"></div>
I'm trying:我正在努力:
continue = WebDriverWait(driver, 20).until(EC.presence_of_element_located((By.CLASS_NAME, 'my-class')) )
continue.click()
but it doesn't work in any of the ways I tried.但它在我尝试过的任何方式中都不起作用。
You should check the xpaths in the browser console.您应该在浏览器控制台中检查 xpaths。 And try doing this?
并尝试这样做?
driver.findElement(By.xpath("//div[contains(@class,'my-class')]"));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.