Hello.
There is such a button:

<input type="submit" value="Начать переписку" accesskey="s" class="button primary" /> 

Trying to press it like this:

 driver.findElement(By.xpath("//input[ @class =\"button primary\"][0]")).click(); 

Not out. I ask for help.

    3 answers 3

    Hey. Use the following code

     driver.findElements(By.xpath(".//input[@class='button primary']")).get(0).click 

      See using firebug if your element is within the specified page in the css code. Perhaps even with the right xpath you will not be able to do it. Thus, having found the visible element click on it, you can try js (JavascriptExecutor) or action (Actions) on the extreme. By the way, your xpath can be written like this:

       //input[@value='Начать переписку'] //input[@type='submit'] //input[@accesskey='s'] //input[@class='button primary'] - наиболее подходит 
         driver.findElement(By.xpath("//input[@class='button primary']")).click();