How do I find out the name of a button by source code?

2

I'm working with a library call , which simulates a web browser. I've read about how to use it, and to click a button, just give a command that involves the name of the button. However, unlike other sites, I can not figure out his name. When I go to the source code, the line that says about the button is this:

<input type="submit" class="btn btn-success" style="float:right;" value="Criar Conta! />

What do I do?

    
asked by anonymous 13.11.2016 / 01:14

2 answers

4

You can do this:

from splinter import Browser

with Browser() as browser:
    browser.visit("url aqui")
    button = browser.find_by_value('Criar Conta!')[0] # agarramos o button pelo seu valor
    button.click()

Note that you have a small error in the HTML that you placed, you should close the quotation marks in value=... :

...value="Criar Conta!" />
    
13.11.2016 / 09:58
4

This control does not have a name.

You can still use other forms to refer to input , such as css, xpath, tag, id, value, text.

Documentation to find elements: Splinter Docs

Example: you can use the value of the form to find it, since it should probably be the only button with the value "Create account!":

browser.find_by_value('Criar conta!')

    
13.11.2016 / 03:00