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

[Bug]: Unable to do ‘Fill’ action in an Input Field in Firefox browser when using JavaScript Playwright Cucumber framework #29614

Closed
manojkumar3101 opened this issue Feb 22, 2024 · 3 comments

Comments

@manojkumar3101
Copy link

Version

1.41.2

Steps to reproduce

I have been working on an automation project using Playwright JavaScript with the Cucumber framework. I've encountered an issue where I am unable to proceed with the "fill" action in the Firefox browser, while the same script runs correctly in Chrome and Edge browsers.
I have given the code and screenshot of the field in which I am facing an issue. I have also attached the XPath for the first input field “Min. QTM.

pageFixture.page.locator("//input[@formcontrolname='min_quantum']").fill(minQuantumValue1);
Screenshot 2024-02-22 181242

Input tag(Xpath)

Expected behavior

The fill action should work fine just like it works for the other two browsers(Chrome and edge)

Actual behavior

The fill action is not working in Firefox browser.
The error massage is displayed in the console as:
Test timeout of 160000ms exceeded.

Error: locator.fill: Test timeout of 160000ms exceeded.
Call log:
  - waiting for locator('//input[@formcontrolname=\'min_quantum\']')
  -   locator resolved to <input type="text" _ngcontent-ng-c2430308819="" formcon…/>
  - elementHandle.fill("99999")
  -   waiting for element to be visible, enabled and editable
  -   element is visible, enabled and editable
  -   locator resolved to <input type="text" _ngcontent-ng-c2430308819="" formcon…/>
  - elementHandle.fill("99999")

401 | if (await this.page.isVisible("//input[@formcontrolname='min_quantum']")) {

402 | await this.page.locator("//input[@formcontrolname='min_quantum']").fill(minQuantumValue1);

Additional context

Workarounds I tried:

  1. Setting timeout for particular field
    await this.page.locator("//input[@formcontrolname='min_quantum']").fill(minQuantumValue1,{timeout:90000});

  2. Playwright Action (Fill and type )
    I tried filling the ‘Min. QTM’ field and clearing the field and typing the field doesn’t work.

await pageFixture.page.locator("//input[@formcontrolname='min_quantum']").fill(minQuantumValue1);
await pageFixture.page.locator("//input[@formcontrolname='min_quantum']").fill('');
await pageFixture.page.locator("//input[@formcontrolname='min_quantum']").type(minQuantumValue1);

  1. JavaScript query selector
    await pageFixture.page.evaluate((minQuantumValue1) => {
    document.querySelector('input[placeholder*=Min]').value = minQuantumValue1;
    }, minQuantumValue1);
    In this approach, I faced another issue as I was able to fill the ‘Quantum’ field but after that ‘Place Response’ button is disabled.

  2. . Playwright Action (Fill) and JavaScript query selector
    Tried filling the ‘Min. QTM ‘field in playwright, then cleared that field and again filled the same field using JavaScript Query selector
    await pageFixture.page.locator("//input[@formcontrolname='min_quantum']").fill(minQuantumValue1);
    await pageFixture.page.locator("//input[@formcontrolname='min_quantum']").fill('');
    await pageFixture.page.evaluate((minQuantumValue1) => {
    document.querySelector('input[placeholder*=Min]').value = minQuantumValue1;
    }, minQuantumValue1);
    On trying this, I got timeout error message

5.Javascript Query selector
Tried filled the ‘Min. QTM’ field in JavaScript Query selector and cleared the same field in JavaScript Query selector and again filled the ‘Min. QTM’ field using the JavaScript Query selector
await pageFixture.page.evaluate((minQuantumValue1) => {
document.querySelector('input[placeholder*=Min]').value = minQuantumValue1;
document.querySelector('input[placeholder*=Min]').value = " ";
document.querySelector('input[placeholder*=Min]').value = minQuantumValue1;
}, minQuantumValue1);
In this approach, I faced another issue as I was able to fill the ‘Min. QTM’ field but after that ‘Place Response’ button is disabled.

6.Try catch method
try {
console.log("Trying...");
await pageFixture.page.locator("//input[@formcontrolname='min_quantum']").fill(minQuantumValue1);
await pageFixture.page.locator("//input[@formcontrolname='min_quantum']").fill('');
await pageFixture.page.locator("//input[@formcontrolname='min_quantum']").type(minQuantumValue1);

        } catch (error) {
            console.log("Catching...");
            await pageFixture.page.evaluate((minQuantumValue1) => {
                document.querySelector('input[placeholder*=Min]').value = minQuantumValue1;
                document.querySelector('input[placeholder*=Min]').value = " ";
                document.querySelector('input[placeholder*=Min]').value = minQuantumValue1;
            }, minQuantumValue1);
        }

Here I am faced another issue. I was able to fill the field but after that the place response button is disabled.

  1. pressSequentially
    await this.page.locator("//input[@formcontrolname='min_quantum']").pressSequentially(minQuantumValue1);
    On trying this approach, error message is displayein the console as:
    Test timeout of 160000ms exceeded.

    Error: locator.pressSequentially: Test timeout of 160000ms exceeded.
    Call log:

  • waiting for locator('//input[@formcontrolname='min_quantum']')
    at ..\pages\DashboardCFP.js:412

Environment

OS: windows11 

Binaries:
  Node: 20.9.0
  npm: 10.2.0
npmPackages:
  @playwright/test: 1.41.2
@yury-s
Copy link
Member

yury-s commented Feb 22, 2024

Please share a repro along with the web page that we could run locally to reproduce the problem.

@yury-s
Copy link
Member

yury-s commented Feb 26, 2024

We need more information to act on this report. Please file a new one and link to this issue when you get back to it!

@yury-s yury-s closed this as completed Feb 26, 2024
@guianino
Copy link

I have a same problem only in Firefox. Did you find any solution?

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

3 participants