Skip to content Skip to sidebar Skip to footer

Selenium Python Click Get Data Button

I am trying to click the GetData button and get the output but this does not work for me. Not sure how can i do this. Code changes below:- from selenium import webdriver from selen

Solution 1:

The selector p.getdata-button>onclick will try to find a p element with a class name of getdata-button.

The second part (>onclick) looks for a direct descendant onclick element.

In short, the selector would match HTML like this:

<p class="getdata-button"><onclick/></p>

To click the button you wan't the input element. This has an id attribute that we can use, and the code becomes:

driver.find_element_by_css_selector('#submitMe').click()

Or

driver.find_element_by_id('submitMe').click()

If you need to find the CSS selector of an element you can let Chrome find it for you by right clicking on the element in the DOM explorer and selecting Copy > Copy selector.

Copy selector in Chrome

Update

Based on the linked answers and my own testing the button is being clicked, but there is some sort of detection in place that prevents the data from being loaded from the server.

I will suggest you look into the linked answers to see if they can help you with this new problem.


Post a Comment for "Selenium Python Click Get Data Button"