Handling Hidden Element

//input[@name=‘username’]

While Entering Data into an input box; Getting Below Error:
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m
[2m - locator resolved to hidden [22m

How to deal here? I am using Browser library.
@falcon030 @damies13 @René

Can you share the HTML of the page and mark the element with which you are trying to interact?

1 Like

Hi Pankaj,

is this on the login screen or a create user screen?

Often the cause of things like this is when the form dynamically display’s / hides fields based on previous input in the form (obviously this doesn’t really apply to a login screen)

Put in a temporary take screenshot step before and see if the field you want is actually on the screen?

If this is a login screen has the page loaded? do you need a wait step to wait for it?

As @falcon030 mentioned seeing the html will help, also for future reference mention the library you’re using so we can suggest the right keywords, is this Browser Library?

Dave.

@falcon030 @damies13 Please find attached. I am using Browser Library.

Browser-Dev Browser

Hi Pankaj,

There is another field with the ID: sso-email, that has the label “Email or Emerates SkyRewards Number”, is this the field you want?

If you do want the username and not sso-email, I see that the username field is hidden, and that’s why browser library can’t interact with it, the element is not showing in the browser.
Is there a radio button or checkbox or similar that switches the login screen between “login with username” and login with “email or SkyRewards number”?

  • You might need to find the item you need to interact with to make the username field not hidden?
  • Or maybe when you fill in sso-email, the javascript on the page might update the username field with the validated value from sso-email? (I’ve seen apps that do this too)

Hope that helps,

Dave.

2 Likes

@Mtest6835 Since Browser Library is based on Playwright I suggest to use Playwright Codegen. With this tool you can record a test and also generate locators. You can then convert the test / locators to Browser Library equivalents. Installing Playwright is quite simple Installation | Playwright

1 Like

@Mtest6835

Further up in the tree it’s showing that field is for mobile, so I’d imagine if you search for the element it would bring back more that one result. Feels/sounds like you need to be a little more specific so your hitting the right one for the view your testing against.

3 Likes