Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Scraping with Python from type="submit"

Have been trying to set up code for scraping a web page in Python. However, I can’t find the code, that helps me identify the "Submit" button in the source code of the web page. See the source code here:

Source code of the web page

What I have tried so far includes:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

log_in_button = driver.find_element_by_css_selector('button.submit')

log_in_button = driver.find_element_by_link_text('Log in')

log_in_button = driver.find_element_by_class_name('buttonstyle__Button-sc-11cbuc5-1 kfFBYh styled__SubmitButton-sc-voms4e-4 jPKYnl')

Also have tried the following, it works, but then a different button to the one I want (in the code it is before the button that I want) is clicked.

log_in_button = driver.find_element(By.XPATH, '//button')

Any suggestions on what else I could try, besides the mentioned?
Sorry if I haven’t got the terminology 100% correct yet, just starting out here. Hope it is clear nevertheless.

>Solution :

log_in_button = driver.find_element_by_css_selector('button.submit')

This does describe button element with class submit, i.e. something like <button class="submit"> whilst you have button with submit type, which in CSS selector language is button[type=submit], so your code shoule be

log_in_button = driver.find_element_by_css_selector('button[type=submit]')
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading