Problem
I'm trying to use mechanicalsoup to login to ORCID, but I'm unable to access the login form.
Attempts
This should be very straightforward:
import mechanicalsoup
browser = mechanicalsoup.StatefulBrowser()
browser.open('https://orcid.org/signin')
browser.select_form('form[id="loginForm"]')
However, this results in a LinkNotFoundError
.
I also tried simply finding any form with a non-stateful browser:
import mechanicalsoup
browser = mechanicalsoup.Browser()
login_page = browser.get('https://orcid.org/signin')
print(login_page.soup.find_all('form'))
And that yields an empty list, so it's not even seeing the form in the return. This confused me, as print(login_page.soup)
returns everything, and I could see the form in there.
Question
How can I access the form and successfully login? (I'm fully open to using something other than mechanicalsoup, too.)
I imagine it has something to do with the fact that you can switch login methods on the page itself. See here:
I'm very far from a frontend expert, but when I inspect the page, I imagine that's governed in some way by the events
seen here:
If anyone can provide any help or insight, I'd certainly appreciate it. Thank you!