0
votes

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. - Connell.O'Donnell

1 Answers

0
votes

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)