I have updated my QAF jar to 4.0.0-RC2 and selinium 4.11.0 with java 1.8 , my FIle upload scenario is not working below is my code
@QAFTestStep(description = "I upload file from mylocal {PARAM_0}") / PARAM_0 = filename /
public void STEPDEF_65d8658901b18502ff21d78c(String PARAM_0) throws Exception {QAFExtendedWebDriver driver = new WebDriverTestBase().getDriver();
System.out.println("Before local file detector");
String fileToUpload = new File(PARAM_0).getAbsolutePath();
System.out.println("fileupload " + fileToUpload);
Path path = Paths.get(fileToUpload);
System.out.println("Real path:" + path.toRealPath().toString());
driver.setFileDetector(new LocalFileDetector());
QAFWebElement elem = driver.findElement("//input[@type='file']");
//JavascriptExecutor jsx = (JavascriptExecutor) driver;
//jsx.executeScript("document.getElementById('//input[@type='file']').value='" + path.toRealPath().toString() + "';");
// System.out.println("After local file elem" + elem);
System.out.println("After local file detector");
//elem.click();
//'type' the file location to it as it were a usual element
System.out.println("fileToUpload:"+fileToUpload);
elem.sendKeys(path.toRealPath().toString());
System.out.println("After local file detector Ended"); }
}
samething worked with qaf 3.2 ,selnium 3.141.59 can you please help
Refer selenium documentation for file upload related help. You can post in user groups with related details like sample anyone can reproduce problem, logs, expected behavior, actual behavior etc.
Hello ,
I have updated my QAF jar to 4.0.0-RC2 and selinium 4.11.0 with java 1.8 , my FIle upload scenario is not working below is my code @QAFTestStep(description = "I upload file from mylocal {PARAM_0}") / PARAM_0 = filename / public void STEPDEF_65d8658901b18502ff21d78c(String PARAM_0) throws Exception {QAFExtendedWebDriver driver = new WebDriverTestBase().getDriver(); System.out.println("Before local file detector"); String fileToUpload = new File(PARAM_0).getAbsolutePath(); System.out.println("fileupload " + fileToUpload); Path path = Paths.get(fileToUpload); System.out.println("Real path:" + path.toRealPath().toString()); driver.setFileDetector(new LocalFileDetector()); QAFWebElement elem = driver.findElement("//input[@type='file']"); //JavascriptExecutor jsx = (JavascriptExecutor) driver; //jsx.executeScript("document.getElementById('//input[@type='file']').value='" + path.toRealPath().toString() + "';");
// System.out.println("After local file elem" + elem); System.out.println("After local file detector"); //elem.click(); //'type' the file location to it as it were a usual element System.out.println("fileToUpload:"+fileToUpload); elem.sendKeys(path.toRealPath().toString()); System.out.println("After local file detector Ended"); } }
samething worked with qaf 3.2 ,selnium 3.141.59 can you please help