Skip to content

Instantly share code, notes, and snippets.

@gabhi
Last active April 29, 2016 02:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabhi/8f9c86f299fcf0cf97cec210195f9e32 to your computer and use it in GitHub Desktop.
Save gabhi/8f9c86f299fcf0cf97cec210195f9e32 to your computer and use it in GitHub Desktop.
Selenium upload file using java
driver.findElement(By.className("fileclass")).click();
driver.switchTo()
.activeElement()
.sendKeys( "/user/agaikwad/test.pdf");
driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
//var aa = $(".bt-request-buffed"); for(i=0;i<aa.length;i++){console.log(aa[i].title); aa[i].click()}
//javascript:(function()%7Bfunction callback()%7B(function(%24)%7Bvar jQuery%3D%24%3Bvar aa %3D %24(".bt-request-buffed")%3B for(i%3D0%3Bi<aa.length%3Bi%2B%2B)%7Bconsole.log(aa%5Bi%5D.title)%3B aa%5Bi%5D.click()%7D%7D)(jQuery.noConflict(true))%7Dvar s%3Ddocument.createElement("script")%3Bs.src%3D"https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fjquery%2F1.7.1%2Fjquery.min.js"%3Bif(s.addEventListener)%7Bs.addEventListener("load"%2Ccallback%2Cfalse)%7Delse if(s.readyState)%7Bs.onreadystatechange%3Dcallback%7Ddocument.body.appendChild(s)%3B%7D)()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment