New answers tagged


Try this solution. Works perfectly in Google Chrome dev tools console.


Method click() that you invoke on located element does not return anything. It is void (you probably used this "type" in some of your methods declaration like public static void main(), etc). So as that method is called the last in your right-hand side of assignment, Java assumes you're trying to assign what the method returns to what you have on left-hand ...


First initialize the WebElement and use it further for click or sendkeys() function. As like below: public void uploadFn() { WebElement uploadElement = driver.findElement(By.xpath("//input[@id='HorizontalLogoPath']"));; uploadElement.sendKeys("D:\\LOGO\\HorizontalLogoPath"); }


Try actions. And also rather creating varaible, recall element again while call send keys, such as Actions myaction= new Actions(Driver.driver); myaction.sendKeys(Driver.driver.findElement(By.xpath("//*@id=\"centralForm:startSerialNumber_input\"]")), Integer.toString(i)) .build() .perform();


There is no straightforward solution for something like this, since it is a content specific problem. StaleElementReferenceException, according to Selenium docs, is thrown in one of two cases: A stale element reference exception is thrown in one of two cases, the first being more common than the second: The element has been deleted entirely. ...

Top 50 recent answers are included