0

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>

Using Selenium in VBA, I tried the following

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

And also I tried

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

But I got an error at this line.

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

3
  • 1
    If you could use selenium to bypass I am not a robot it wouldn't be very useful. Commented Jul 17, 2019 at 11:14
  • This is the second post I've seen this week where someone is trying to do exactly what the site doesn't want them to do. It might be doable but what you are attempting to do may very well be illegal. I would strongly advice against it Commented Jul 17, 2019 at 11:15
  • @Zac Thanks a lot. I have edited the main post and removes any illegal requests. Commented Jul 17, 2019 at 12:09

1 Answer 1

1

To click() on the element, as the desired element is within an <iframe> so you have to:

  • Induce a waiter and switch to the desired frame.
  • Induce a waiter for the desired element to be clickable.
  • You can use the following solution:

    .SwitchToFrame.FindElementByXPath("//iframe[contains(@src, 'recaptcha') and not(@title='recaptcha challenge')]", timeout:=10000)
    .FindElementByCss("div.recaptcha-checkbox-checkmark").Click
    

You can find similar discussions in:

Here you can find a relevant discussion on Ways to deal with #document under iframe

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks a lot for great help. I appreciate a lot your help.
@DebianjanB I have faced another similar page and I used Ctrl + F to find Xpath div.recaptcha-checkbox-checkmark and found three not only one. how can I specify the first one of them?
@YasserKhalil Let's discuss the issue in details in Selenium room.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.