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

Upload is not working with WebElementFacade #3277

Open
jurec72 opened this issue Oct 3, 2023 · 1 comment
Open

Upload is not working with WebElementFacade #3277

jurec72 opened this issue Oct 3, 2023 · 1 comment

Comments

@jurec72
Copy link

jurec72 commented Oct 3, 2023

What happened?

Hi,
I use latest Serenity version and have issue with upload file when use sendKeys or upload().to() on Selenium , Java.
Error:
org.openqa.selenium.ElementNotInteractableException: Timed out after 3 seconds. Element not available.

Code example:
` @findby(xpath = "//input[contains(@Class,'TaskAttachments_task-attachments__upload-field')]")
public WebElementFacade attachmentsInput;

public void test() {
File file = new File(IFilePaths.FILES_TDOC_FOLDER, "default.tdoc");
upload(file.getPath()).to(tasksPanelPage.attachmentsInput);
}
or
public void test() {
File file = new File(IFilePaths.FILES_TDOC_FOLDER, "default.tdoc");
tasksPanelPage.attachmentsInput.sendKeys(file.getPath());
}
`

But when I use just By element then it is working:

`
public void test() {
File file = new File(IFilePaths.FILES_TDOC_FOLDER, "default.tdoc");
upload(file.getPath()).to(find(tasksPanelPage.attachmentsInput));
}

or

By attachmentsInput = By.xpath("//input[contains(@Class,'TaskAttachments_task-attachments__upload-field')]");

public void test() {
File file = new File(IFilePaths.FILES_TDOC_FOLDER, "default.tdoc");
find(tasksPanelPage.attachmentsInput).sendKeys(file.getPath());
}
`

What did you expect to happen?

Should upload file with WebElementFacade.

Serenity BDD version

4.0.12

JDK version

JDK-11

Execution environment

No response

How to reproduce the bug.

Steps to reproduce:

  • upload any file to any website by using WebElementFacade!

How can we make it happen?

Work on this myself and propose a PR (with Serenity BDD team guidance)

@wakaleo
Copy link
Member

wakaleo commented Oct 3, 2023

Have a look at the code, but I'm not sure this is Serenity-related. find() returns a WebElementFacade, so the code is very similar - that said, I never use @findby because I find it unreliable in general.

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

No branches or pull requests

2 participants