Answer the question
In order to leave comments, you need to log in
How to find an element on a web page?
The page has radio buttons with city names. The history of city selection is displayed in a separate block on the right.
I select the element I need like this:
IWebDriver driver = new ChromeDriver();
IWebElement element = driver.FindElement(By.XPath("//*[contains(text(), '" + CityName + "')]"));
element.Click();
Answer the question
In order to leave comments, you need to log in
Just add some specifics to the xpath (assuming div1 is the only class):
It's not the most elegant way, but it should work. There may be several options to solve the problem, but you need to look at the html code of the page for this.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question