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

How to upload file? #19483

Closed
YusuffOzt opened this issue Dec 15, 2022 · 1 comment
Closed

How to upload file? #19483

YusuffOzt opened this issue Dec 15, 2022 · 1 comment

Comments

@YusuffOzt
Copy link

->fixtures(folder)
-share.csv(file)
->playwrgiht(folder)
-test(folder)
--channels.config.ts(file)
--login.config.ts(file)

You can see my folder structure above. I have a share.csv file in fixtures folder and want to upload share.csv file in my channels.config.ts (By clicking Upload file button). You can see the web directory of the Upload File button below

<button type="button" class="ant-btn secondary-btn width-full text-left"><span class="fa fa-upload"></span><span>Upload File</span></button>

In my channels.config.ts I tried below code but got error.
await page.getByText('Upload File').setInputFiles('../../fixtures/share.csv');

Also tried using xpath instead of using getByText text but took error again. You can see error below;

frame.setInputFiles: Error: Node is not an HTMLInputElement
=========================== logs ===========================
waiting for selector "//span[contains(text(),'Upload CSV file')]"
  selector resolved to visible <span>Upload CSV file</span>
============================================================

   at playwright/tests/channels/channels.e2e.ts:87

  85 |                 
  86 |                 await page.locator(ChannelsPageRepository.shareButton).click()
> 87 |                 await page.locator(ChannelsPageRepository.uploadFileButton).setInputFiles('/Users/test/Desktop/test/fixtures/share.csv');
     |                 ^
@YusuffOzt
Copy link
Author

Open different issue adding Question tag

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

1 participant