Grab a button in Splinter (python)

Question:

For most of the buttons I try to grab using Splinter, the commands that are on this site ( https://splinter.readthedocs.io/en/latest/finding.html ) are enough.

However, for this specific button, I can't find a way to grab it.

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

What to do if I can't identify his name or id?

Answer:

Like your earlier question I answered, it's possible but instead of the find_by_value method use find_by_css , which sets the html element's css selector:

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' by your html tag:

browser.find_by_tag('button')

Or even by the text:

browser.find_by_text('Vote')
Scroll to Top