I need to click on the "Browse" button on the below webpage.
http://www.guru99.com/freelancing.html
I have written the below code but webdriver fails to find the Browse button element. Please help.
import java.io.IOException;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class FileUpload {
public static void main(String[] args) throws IOException {
System.setProperty("webdriver.gecko.driver", "C:\\Eclipse\\Drivers\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.navigate().to("http://www.guru99.com/freelancing.html");
driver.findElement(By.id("theFile_link(Resume)")).click();
//Below line execute the AutoIT script
Runtime.getRuntime().exec(System.getProperty("user.dir")+"\\FileUpload.exe");
driver.close();
}
}
I'm Using:
Firefox Version: 49.0.1
Selenium Version: Version 3.0.0-beta4
OS: Win10 64 bit
Java: 1.8
AutoITscript instead of just send path to file to//input[@id="theFile_property(Resume)_1"]