使用 Selenium 和 VBA Excel 的 reCAPTCHA 复选框的 CSS 选择器 [英] CSS selector for reCAPTCHA checkbok using Selenium and VBA Excel

查看:18
本文介绍了使用 Selenium 和 VBA Excel 的 reCAPTCHA 复选框的 CSS 选择器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我尝试填写某些字段的网站上,有一个复选框,我需要单击以在其中添加复选标记:

On the website I am trying to fill in some fields on, there is a checkbox that I need to click to add the check mark in it:

<div class="rc-anchor-content"><div class="rc-inline-block"><div class="rc-anchor-center-container"><div class="rc-anchor-center-item rc-anchor-checkbox-holder"><span class="recaptcha-checkbox goog-inline-block recaptcha-checkbox-unchecked rc-anchor-checkbox recaptcha-checkbox-expired" role="checkbox" aria-checked="false" id="recaptcha-anchor" dir="ltr" aria-labelledby="recaptcha-anchor-label" aria-disabled="false" tabindex="0"><div class="recaptcha-checkbox-border" role="presentation" style=""></div><div class="recaptcha-checkbox-borderAnimation" role="presentation" style=""></div><div class="recaptcha-checkbox-spinner" role="presentation" style="transform: rotate(180deg);"></div><div class="recaptcha-checkbox-spinnerAnimation" role="presentation" style=""></div><div class="recaptcha-checkbox-checkmark" role="presentation"></div></span></div></div></div><div class="rc-inline-block"><div class="rc-anchor-center-container"><label class="rc-anchor-center-item rc-anchor-checkbox-label" aria-hidden="true" role="presentation" id="recaptcha-anchor-label"><span aria-live="polite" aria-labelledby="recaptcha-accessible-status"></span>I'm not a robot</label></div></div></div>

在VBA中使用Selenium,我尝试了以下

Using Selenium in VBA, I tried the following

.FindElementByCss("div.recaptcha-checkbox-border").Click

我也试过了

.FindElementByCss("span.recaptcha-checkbox").Click

但是我在这一行遇到了错误.

But I got an error at this line.

这是网站的链接,可以查看整个 HTMLhttps://www.moj.gov.kw/AR/电子政务/页面/eServices01.aspx

Here's the link of the website to see the whole HTML https://www.moj.gov.kw/AR/E-Gov/Pages/eServices01.aspx

推荐答案

To click() 在元素上,因为所需的元素在