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.
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.
Can anyone provide any input about this discrepancy?
Do we have any workaround for this?
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4