I have tried all the grabbing methods and I was not able to click on Not Now.
Xpath never worked, CSS selector..etc
enter image description here
You can try to click by text in the button, something like this:
driver.find_element_by_xpath("//button[contains(string(.),'Not Now']").click()
Related
enter image description here
I'm having trouble clicking the Sign Up Now button which seems to be different than an input type button. It is also using ng-click and not sure how I can click on the button after multiple failed attempts.
Thank you for the help!
Try copiing the XPath and then using driver.find_element_by_xpath(copied xpath) function for locating the element and then check this out - may help with clicking.
You can select it by name as JD2775 said, if you want to read a little more about it https://selenium-python.readthedocs.io/locating-elements.html
you can try with
btn = driver.find_element_by_name('btnSignUp').click()
or
btn = driver.find_element_by_name('btnSignUp')
btn.click()
or something like that
So I have the HTML code:
enter image description here
How do I click this button? What is the Xpath for this one?
The xPath to that particular image is
/html/body/img
To click it
driver.findElement(By.xpath("/html/body/img")).click()
For xpath you need to have a path from top level upto this button.
Would look something like html\body\div\button [ just an example ].
You will have to check the whole page to navigate to that button using xpath.
Another better way could be using find element by class="auth-button positive" and then click() it
I try to press a button using selenium. How do I click on a particular button using several conditions? (https://ibb.co/cJZxD7b) describing image
I have already tried something like this //span[text()=1.01], but what if webpage have few buttons with the same text.
wait(browser, 10).until(EC.element_to_be_clickable((By.XPATH, "//div[text()='45.00 7.75 1.04'] and //span[text()=1.04"))).click()
I expect to click on particular button
You can try with xpath
//span[#class='stn-val']
But it would probably be the best if you shared more of the HTML code because now I'm only guessing based on what I see.
Also, are you getting any error messages?
UPDATE:
Based on HTML posted in comments, use this selector:
//div[#class="st-col-bet-container"][2]/ul/li[3]/span
For tips on xpath selectors, see here.
The html is as followed:
enter image description here
I have tried multiple methods like driver.find_element_by_css_selector and others. None worked.please help
Without knowing more information, try to use XPATH and .click()
driver.find_element_by_xpath('//a[#class="button checkout"]').click()
i used Selenium IDE on Firefox to find the xpath of buttons. The next step is to click the button on Python. I tried inserting the xpath in the code below, but no luck. I do not know how to change the xpath so that it fits to the code below.
browser.find_element_by_xpath('')
Any help is appreciated!
Be careful with quotes and double quotes, use double outside and simple inside, for example
"//*[#class='myClass']"
Try this:
browser.find_element_by_xpath("(//button[#type='button'])[209]")
You should get the selector manually in another way, this selector is not reliable at all, if any of the previous button is missing you will click the wrong button.