Finding HTML elements to use in Selenium WebDriver

shawshank

New Member
Using Selenium WebDriver in a java class where I try to find that specific element and then automatically add a needed amount of that element in the input field.I have an HTML table with each row specifying a type of element and an input field used to add X to the amount of element in the specific row.\[code\]<tr> <td class="non-sortable-table"> <input class="required text" type="text" value="http://stackoverflow.com/questions/9720528/0" name="plate_order{pageFlow.plateorders[0].numberOfPlates}" tabindex="25"> </td> <td class="non-sortable-table"> <span>20% - White plates</span> </td> ...</tr>\[/code\]I have tried the following in my Java code in order to get that element, but with no luck:\[code\]WebElement element = (WebElement) js.executeScript("return ${\"document.getElementsByName('plate_order{pageFlow.plateorders[0].numberOfPlates}')\"");WebElement element = driver.findElement(By.ByName('plate_order{pageFlow.plateorders[0].numberOfPlates}'))\[/code\]how could i retreive that element in order to edit its input?Is it possible when parts of the name of the element is a reference to a controller, i.e. pageFlow?what if i wanted to retrieve the following element identified by 20% .... I have tried to get that one using xpath and cssSelector with no luck.Any suggestions?
 
Top