I am looking site. In inspect element see this:
<span id="item60" title="Havai 30" class="item button link">Get</span> <span id="item90" title="Classic 50" class="item button link">Get</span>
Need to get and click element by title. Something like this:
browser.find_element_by_xpath('//*[@id="item60"]').click()
But via title.
We can find and click elements by title in Selenium webdriver. An element can be identified with a title attribute with xpath or css selector. With the xpath, the expression should be //tagname[@title='value']. In css, the expression should be tagname[title='value'].
We can click a button with Selenium webdriver in Python using the click method. First, we have to identify the button to be clicked with the help of any locators like id, name, class, xpath, tagname or css. Then we have to apply the click method on it. A button in html code is represented by button tagname.
Go to the First name tab and right click >> Inspect. On inspecting the web element, it will show an input tag and attributes like class and id. Use the id and these attributes to construct XPath which, in turn, will locate the first name field.
We can find an element that contains specific text with Selenium webdriver in Python using the xpath. This locator has functions that help to verify a specific text contained within an element. The function text() in xpath is used to locate a webelement depending on the text visible on the page.
Like barak manos said the answer was:
'//*[@title="Havai 30"]'
With [0] at ending, case it was list.
browser.find_element_by_xpath('//*[@title="Havai 30"]').click()
This Will Work for me Like you said.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With