File Upload using Selenium WebDriver and Java Robot Class

后端 未结 7 1801
说谎
说谎 2020-11-28 07:19

I am using Selenium WebDriver and Java and I need to automate the file upload feature. I tried a lot, but the moment the Browse button is clicked and a new window opens the

相关标签:
7条回答
  • 2020-11-28 07:54

    Click on the button and use the below code. Notice the use of '\\' instead of '\' in the path name,it is important for the code to work..

    WebElement file_input = driver.findElement(By.id("id_of_button"));
    file_input.sendKeys("C:\\Selenium\\ImageUpload_FF.exe");
    
    0 讨论(0)
提交回复
热议问题