Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Kirthika88 opened this issue Feb 26, 2024 · 1 comment
Open

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

Kirthika88 opened this issue Feb 26, 2024 · 1 comment

Comments

@Kirthika88
Copy link

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
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants