TestProject Forum

CSS Selectors Found in Chrome but not in Firefox

I have a CSS selector that is found in Chrome but not in Firefox.

There are several elements on the page, similar to the following <input> element, that are nested within several <div> elements.

As you can see, our ids are auto-generated, so cannot be relied upon. Instead, the name attribute is unique, so it can be used.

The CSS selector is defined as: input[name="legal_first_name"].
There are also several XPATH interpretations to fall back on.

The test step successfully runs in Chrome:

    textfield-1089-inputEl<Textbox>
    Found by CSSSELECTOR:input[name='legal_first_name']

However, in Firefox:

    1. CSSSELECTOR=input[name='legal_first_name']
TimeoutException: Timeout occurred while trying to perform the action. Element was not found
2. XPATH=//div[1]/div[1]/div/div/input
TimeoutException: Timeout occurred while trying to perform the action. Element was not found
3. XPATH=/html/body/div[1]/div/div[2]/div/div/div/div[1]/div/div[2]/div/div/div/div/div/div[3]/div[2]/div/div/div/div[1]/div[1]/div/div/input
TimeoutException: Timeout occurred while trying to perform the action. Element was not found

Hello @james.storey
Please open your website on FireFox and check if that is correct locator for the element in firefox, perhaps it has a different name there.

Hi @ran.tzur,

Yes, I can confirm that the CSS locator is the same on Firefox as it is on Chrome, with the same attributes.

Hi James,
It can be caused due to differences in render speed of browsers.
Try to increase the adaptive wait time of the test.

Then select settings:
image

Increase the adaptive wait time:

If that doesn’t help please try to change the execution speed from fast to normal:

Let me know if it works for you.

Unfortunately, this didn’t work.

Just to be sure I ran the test also at “Turtle Slow” and “4000ms” and it still produced the same failure result.

When I watch the test run and visually monitor its behaviour, in Firefox, I can see that the element is visible on the page, but in Firefox , it not selected. There is an obvious delay (probably meaning it cannot see the selector), and then it tries to select something else on the page, which is not correct, and from that moment the rest of the test is invalid as it continues to attempt at (incorrectly) selecting elements to interact with.

Hello again @james.storey
Is the website you are testing public?
If so, can you please share some information over at support@testproject.io so we can see how we can further assist you.

Hi @ran.tzur,

I’m afraid it is not public, but is a commercial product.
Please let me discuss with senior staff to see how we can arrange support on the matter.

Kind regards,