title: sendKeys() in Selenium WebDriver
body: <p>I am new to Selenium and I am trying to upload a file using WebDriver. Here I am trying to click browse button using dom element as follows:</p>
  
  <pre><code>selenium.type("document.forms['UploadForm'].elements['browsebutton']",file.getAbsolutePath());
  </code></pre>
  
  <p>But since the approach did not work am trying to hit browse button using WebDriver element as below: How can i change my dom element to xpath or css selector as below?</p>
  
  <pre><code>driver.findElement(By.cssSelector("input[type=\"file\"]")).click();
  </code></pre>
  
  <p>I cant write xpath as</p>
  
  <pre><code>selenium.click("xpath="//input[@name='uplaod' and @value='browsebutton']");
  </code></pre>
  
  <p>since i have multiple browse buttons with same name and value.. So i need to pick using dom element itself. How do i do it?</p>
  
  <p>Thanks in advance for help.</p>
  
  <p>Dominik i have tried using the below xpath since there is no name attribute:But not working</p>
  
  <pre><code>String upload="(//input[@name='bulkUnBlockUploadForm' and @value='requestFile'])[2]";
  String button="(//input[@name='bulkUnBlockUploadForm' and @value='process'])[2]";
  </code></pre>
  
  <p>I tried using id as well:Not working</p>
  
  <pre><code>   String upload="(//input[@id='content' and @value='requestFile'])[1]";
      String button="(//input[@id='content' and @value='process'])[1]";
  </code></pre>
  
  <p>The issue is in my jsp,i have 2 browse buttons s with same id and same value,but different form.I have 2 submit buttons for each of browse buttons with same id and same value,but different forms.So when am using the above approaches its hitting both the submit buttons</p>