question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Authentication Pop up displayed by Chrome is available in Inspect tool but not in PageSource

See original GitHub issue

Hello @yodurr and Team,

I was trying to fill userid and password for an authentication Pop up displayed by Chrome browser I see that Inspect tool was able to recognize the edit boxes but when I tried findElement using XPath those elements are not available.

chrome-authenticationpopup-available-in-inspect

I checked the Page Source, these elements are not available. Below is the Page Source

  <Window AcceleratorKey="" AccessKey="" AutomationId="" ClassName="Chrome_WidgetWin_1" FrameworkId="Win32" HasKeyboardFocus="False" HelpText="" IsContentElement="True" IsControlElement="True" IsEnabled="True" IsKeyboardFocusable="True" IsOffscreen="False" IsPassword="False" IsRequiredForForm="False" ItemStatus="" ItemType="" LocalizedControlType="window" Name="/Desktop/HomePage/Default.aspx - Google Chrome" Orientation="None" ProcessId="8696" RuntimeId="42.853252" x="0" y="0" width="0" height="0" CanMaximize="True" CanMinimize="True" IsModal="False" WindowVisualState="Normal" WindowInteractionState="ReadyForUserInteraction" IsTopmost="False" CanRotate="False" CanResize="True" CanMove="True" IsAvailable="True">
    <Pane AcceleratorKey="" AccessKey="" AutomationId="-275121376" ClassName="Chrome_RenderWidgetHostHWND" FrameworkId="Win32" HasKeyboardFocus="False" HelpText="" IsContentElement="True" IsControlElement="True" IsEnabled="True" IsKeyboardFocusable="True" IsOffscreen="False" IsPassword="False" IsRequiredForForm="False" ItemStatus="" ItemType="" LocalizedControlType="pane" Name="Chrome Legacy Window" Orientation="None" ProcessId="8696" RuntimeId="42.1376980" x="0" y="0" width="0" height="0" HorizontallyScrollable="False" VerticallyScrollable="False" HorizontalScrollPercent="0" VerticalScrollPercent="0" HorizontalViewSize="100" VerticalViewSize="100" IsAvailable="True" />
    <TitleBar AcceleratorKey="" AutomationId="TitleBar" ClassName="" FrameworkId="" HasKeyboardFocus="False" IsContentElement="False" IsControlElement="True" IsEnabled="True" IsKeyboardFocusable="True" IsOffscreen="True" IsPassword="False" IsRequiredForForm="False" ItemStatus="" ItemType="" LocalizedControlType="title bar" Orientation="None" ProcessId="8696" RuntimeId="42.853252.1.-2147483647.853252.-2.0" x="0" y="0" width="0" height="0">
      <MenuBar AcceleratorKey="" AccessKey="Alt+Space" AutomationId="MenuBar" ClassName="" FrameworkId="" HasKeyboardFocus="False" IsContentElement="False" IsControlElement="True" IsEnabled="True" IsKeyboardFocusable="True" IsOffscreen="False" IsPassword="False" IsRequiredForForm="False" ItemStatus="" ItemType="" LocalizedControlType="menu bar" Name="System" Orientation="None" ProcessId="8696" RuntimeId="42.853252.1.-2147483646.8696.21693365.0" x="0" y="0" width="0" height="0">
        <MenuItem AcceleratorKey="" AccessKey="Space" AutomationId="" ClassName="" FrameworkId="" HasKeyboardFocus="False" IsContentElement="True" IsControlElement="True" IsEnabled="True" IsKeyboardFocusable="True" IsOffscreen="False" IsPassword="False" IsRequiredForForm="False" ItemStatus="" ItemType="" LocalizedControlType="menu item" Name="System" Orientation="None" ProcessId="8696" RuntimeId="42.853252.1.-2147483646.3468.21693365.1" x="0" y="0" width="0" height="0" ExpandCollapseState="Collapsed" IsAvailable="True" />
      </MenuBar>
      <Button AcceleratorKey="" AutomationId="" ClassName="" FrameworkId="" HasKeyboardFocus="False" IsContentElement="False" IsControlElement="True" IsEnabled="True" IsKeyboardFocusable="False" IsOffscreen="False" IsPassword="False" IsRequiredForForm="False" ItemStatus="" ItemType="" LocalizedControlType="button" Name="Minimize" Orientation="None" ProcessId="8696" RuntimeId="42.853252.1.-2147483647.853252.-2.2" x="0" y="0" width="0" height="0" />
      <Button AcceleratorKey="" AutomationId="" ClassName="" FrameworkId="" HasKeyboardFocus="False" IsContentElement="False" IsControlElement="True" IsEnabled="True" IsKeyboardFocusable="False" IsOffscreen="False" IsPassword="False" IsRequiredForForm="False" ItemStatus="" ItemType="" LocalizedControlType="button" Name="Maximize" Orientation="None" ProcessId="8696" RuntimeId="42.853252.1.-2147483647.853252.-2.3" x="0" y="0" width="0" height="0" />
      <Button AcceleratorKey="" AutomationId="" ClassName="" FrameworkId="" HasKeyboardFocus="False" IsContentElement="False" IsControlElement="True" IsEnabled="True" IsKeyboardFocusable="False" IsOffscreen="False" IsPassword="False" IsRequiredForForm="False" ItemStatus="" ItemType="" LocalizedControlType="button" Name="Close" Orientation="None" ProcessId="8696" RuntimeId="42.853252.1.-2147483647.853252.-2.5" x="0" y="0" width="0" height="0" />
    </TitleBar>
  </Window>

I even tried finding all child elements using XPath i.e. “.//*” Below is the chunk of code

IWebElement ChromeWindow = desktopSession.FindElementByClassName("Chrome_WidgetWin_1");

IList<IWebElement> editChilds = ChromeWindow.FindElements(By.XPath(".//*"));
Console.WriteLine(editChilds.Count);
            foreach(IWebElement e in editChilds){
                Console.WriteLine(e.GetAttribute("innerHTML"));
                Console.WriteLine(e.Text);
                Console.WriteLine(e.TagName);
            }

Below is the output I have got.

chrome-authenticationpopup-available-in-inspect-chromechilds-output

Can anyone provide any input about this discrepancy? Do we have any workaround for this?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

5reactions
dhapolapankajcommented, Nov 2, 2017

Hi @khouzam @yodurr @timotiusmargo

I can confirm that the RC2 version is now identifying the Chrome Authentication pop up dialog. I just tested it and it worked like a charm!

IWebElement chromeWindow = desktopSession.FindElementByXPath(".//Window[contains(@ClassName,'Chrome') ]");

IWebElement SecurityPopupWindow = chromeWindow.FindElement(By.XPath(".//Custom[@Name='Authentication required']"));

SecurityPopupWindow.FindElement(By.XPath(".//Edit[@Name='Username']")).Clear(); SecurityPopupWindow.FindElement(By.XPath(".//Edit[@Name='Username']")).SendKeys(data[0]);//To Enter User Id SecurityPopupWindow.FindElement(By.XPath(".//Edit[@Name='Password']")).Clear(); SecurityPopupWindow.FindElement(By.XPath(".//Edit[@Name='Password']")).SendKeys(data[1]);//To Enter Password SecurityPopupWindow.FindElement(By.XPath(".//Button[@Name='Log in']")).Click();//To click Log in

Out of curiosity I tried for Firefox Authentication Pop up as well, and I can see those elements in Page Source.

Thanks for prioritizing this one! Regards PD

2reactions
hassanuzcommented, Nov 14, 2017

Thanks for the validation, @dhapolapankaj, happy to see that it works!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to stop the inspect element pop up that keeps ...
How do I turn off Inspect Element in chrome? To do so, begin by opening the Developer Tools and click on the element...
Read more >
Chrome Developer tool: html script is blank (in source) ...
Why does Chrome Developer Tool add elements not in the file? 1 · Cannot view source HTML on Chrome · 17 · Chrome...
Read more >
How To Inspect Element In Chrome using DevTools ...
But using Developer Tools to inspect the element and modify the DOM ... Right Click on the webpage in Chrome Browser and click...
Read more >
How to inspect a pop-up coming up to enter login ...
The popup that comes is not a javascript popup [ which is what WebDriver can deal with] but is a browser popup. You...
Read more >
How To Handle Login Pop-up In Selenium WebDriver ...
Before we dive in deep and see how to handle login pop-up in Selenium ... Free Online Tools · Mobile Testing Advisor ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found