I have tried to figure this out for a while - no luck.
I want to click this button:
<button name="showMoreButton" data-test-id="show-more-button" aria-label="Show More" type="button" class="uitk-button uitk-button-medium uitk-button-has-text uitk-button-primary">Show More </button >
I have been trying things like this I have found all over the place, but none work:
element_to_click = driver.find_element(By.xpath("//button[@data-test-id='show-more-button']").click() element_to_click = driver.find_element(By.cssSelector(".uitk-button uitk-button-medium uitk-button-has-text uitk-button-primary")).click()
I think the first failure occurred because Selenium appears to be unable to handle "data-test-id" - something that strikes me a curious weakness...
I can't understand why the second failure occurred.
Thanks so much for any help.
Ellie The Good Dog
.click()
.By.XPATH
By.XPATH
as a separate function, but it's not. It's just the first argument tofind_element()
, like so:driver.find_element(By.XPATH, '//something')
I think you must have copied from a Java selenium example, but the Python version is a bit different.