qmetry / qaf

Quality Automation Framework for web, mobileweb, mobile native and rest web-service using Selenium, webdrier, TestNG and Java Jersey
https://qmetry.github.io/qaf
MIT License
253 stars 137 forks source link

Unable to do FILE UPLOAD with qaf 4.0.0-RC2 #453

Open Kirthika88 opened 8 months ago

Kirthika88 commented 8 months ago

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

cjayswal commented 8 months ago

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.