Grab a button in Splinter (python)

2

For most buttons that I try to grab using Splinter, the commands that are on this site ( link ) suffice.

However, for this particular button, I do not find a way to grab it.

<button type="submit">Vote</button>

How do I do if I can not identify his or her id?

    
asked by anonymous 13.11.2016 / 20:56

1 answer

2

As your earlier question to answer, it is possible but instead of find_by_value method use find_by_css , which defines the css selector of the html element:

from splinter import Browser

with Browser() as browser:
    browser.visit("url aqui")
    button = browser.find_by_css('button[type="submit"]')[0] # agarramos o button seletor css
    button.click()

You can also 'grab' your html tag:

browser.find_by_tag('button')

Or even by the text:

browser.find_by_text('Vote')
    
13.11.2016 / 21:19