0

I am trying to get Selenium to interact with a button on a website, but the button has no identifiers other than class (and I haven't gotten that working) and ng-click. How do I tell Selenium to locate the value at ng-click (or wherever), and then select it? Below is the code for the button when I inspect it:

Also: this button has a bunch of non-clickable items in it, I really just want to know how I can tell Selenium I want to click the button defined in the HTML code. Thank you! I'm working in Python. the button looks like this::
the button looks like this:

<div class="col-xs-6 iml-col-xs-12">
  <div class="btn btn-create-account" ng-click="goToSSORedirectPage()">
    <span>
      <i class="fa fa-user">
        ::before
        </i>
      </span>
      <small class="text-muted">HAVE A TULANE EMAIL ADDRESS </small>
       "Member Login"
     </div>
   </div>
1
  • Please post your code as text rather than an image. Commented Feb 16, 2021 at 18:19

1 Answer 1

0

Possible duplicate of Python Selenium - How to click element that is not a button

As a workaround, you could try getting the value of ng-click property and calling the button's function. If the element doesn't have an ID, you can retrieve a reference to the element from its children or parent nodes. Alternatively, use find_elements_by_class_name("content"), but that will likely return more elements, as classes can be reused.

A working example:

button_function=driver.find_element_by_id('id_of_the_button').get_attribute("ng-click")
driver.execute_script(button_function)

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

Comments

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.