Join 500+ Software Testing professionals. Solve problem and get your problem solved. Register Now!

WARNING: WebDriverException thrown by findElement(By.xpath:

Open 1 Answers 157 Views
1 1

For the below code:

public class CommentTask {
    WebDriver driver;
    public CommentTask(WebDriver driver)
        this.driver = driver;

    public void commentOnTask()
        WebDriverWait wait = new WebDriverWait(driver, 10);
        try {
        catch(org.openqa.selenium.TimeoutException e){
        driver.findElement(By.className("text_div")).sendKeys("Test Comment");
    WebElement submitButton =    wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@id=\"comments-task-6-59ba23e91bb06\"]/div/div/div[3]/div[2]/form/button")));;



Am able to enter text into the Comment field but unable to find the path of Submit button and click on it. getting below exception:
WARNING: WebDriverException thrown by findElement(By.xpath: //*[@id="comments-task-6-59ba23e91bb06"]/div/div/div[3]/div[2]/form/button)
org.openqa.selenium.WebDriverException: Failed to decode response from marionette.

Can you please help me with this

commented by (91 points)
Thanks. Please help me on this

1 Answer


It looks like your ID, 


is dynamically generated. I suggest you use regular expression in your XPath expression.

Something as given below.


The above may not work as I just tried to give you an example. You can find regular expression by googling it out.

answered by (531 points)
commented by (91 points)
It worked with the below regular expression :
//*[contains(@id, 'comments-task')]/div/div/div[3]/div[2]/form/button

commented by (531 points)
Thank you for sharing your solution!
commented by (531 points)
I have created a new question related to your solution. It would be great if you can post your solution there.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.