I am running the script to automate test cases and having this unique problem. I have detected and used IDs of the elements for click etc. purpose. However, all of a sudden
You can utilize CSS for this. For your element, looks like its:
<* id="tile276_input" />
What you need to do is find out what is changing about it. I assume it's the number inbetween. If it is, then your selector would look something like:
By.cssSelector("*[id^='tile'][id$='input']")
This will look for anything that has an ID that "starts with tile
" and "ends with input
. In our case, "tile276_input"
matches that.
See this article if you want more information
WebElement element = driver.getElement(By.cssSelector("[id^='title']);
Or
WebElement element = driver.getElement(By.cssSelector("id:contains('title')"));
You Can use this element to do desired actions.
You also can try contains
and starts-with()
for such things
driver.findElement(By.xpath("//*[contains(@id,'title')]"))
or
driver.findElement(By.xpath("//* [start-with(@id,'title')]"))