Everything seems to be working smoothly with that code! It successfully locates and clicks on my button within the span tag.
driver.findElement(By.cssSelector("span[id$=somePagesCollection] a")).click();
However, after clicking the button, an input field appears.
driver.findElement(By.cssSelector("span[id$=somePagesCollection] input[id$=somePagesCollection_0_url]")).sendKeys("some");
But now I'm encountering an issue:
org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"css selector","selector":"span[id$=somePagesCollection] input[id$=somePagesCollection_0_url]"} Command duration or timeout: 16 milliseconds
I've checked the outer HTML of the element, but can't seem to figure out what I'm doing wrong.
<input id="s567bb2e58337a_somePagesCollection_0_url" name="s567bb2e58337a[somePagesCollection][0][url]" required="required" class=" form-control" type="url">
For example, in the browser console:
$('span[id$=somePagesCollection] input[id$=somePagesCollection_0_url]').hide()
Another successful example from the browser console that doesn't work in Selenium:
$('span[id$=somePagesCollection] tr:nth-child(2) td:nth-child(2) input').hide()