--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/88910d95-7c80-4d06-b5f1-4ebf5977cb9e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Using robot class you can handle...thing which u need to do is put the page load time before u invoke url and apply try catch for that block...once u got the exception u will be going into exception block ...ther use robot class
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAEzR4Zz_aiH%3DoR%2B271X1t9fcdpsW2n8XBS8ZgfSX2fgXW5NBWQ%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/ab233eb6-e52f-4590-aeec-4d44c79fe808%40googlegroups.com.
Hi All,Is their any possibility we can create a dot net based console application exe, which can leverage the use of CUIT classes Like WinEdit, WinButton and WinWindow. This exe will take args[] as UID and PWD and handle the authentication window?
Has anyone tried this?Thanks
PD
On Monday, April 20, 2015 at 9:45:38 PM UTC+5:30, sushant umbarkar wrote:
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/7ccafe4e-2e29-4b25-8e0d-1ff06f5194e7%40googlegroups.com.
Pankaj Dhapola ,
I have such tool developed via c# with somewhat heavy win32 p/invoke code, and can help you with your authentication
the screenshot manages to access file name and "ok" button(the button text is changed) - to work with your dialog i need to have access to your scenario, to tailor the tool code to find your particular window class chain.
I own the code so it will not be a problem , but i do not have IIS / Windows domain integration to try it upfront.
Let me know if you are interested in pursuing this project
or interested in srufying the source yourself on my github
Thanks,
Serguei Kouzmine
driver.Url = authenticationPage;
IAlert alert = driver.SwitchTo().Alert();
alert.SetAuthenticationCredentials("User", "password");
alert.Accept();
There's no need for AutoIt, someone else's open source dialog handler (my own is available at https://github.com/jimevans/BrowserDialogHandler), or any other project that people might suggest.
Caveats to using this: While it's implemented as part of the WebDriver JSON wire protocol, it hasn't been standardized by the W3C yet. Furthermore, only the IE driver has implemented the feature at present, but remember that you can pass user name and password information in the URL for other browsers.
[1] Yes, this includes file dialogs. Uploading files can be done with SendKeys; clicking on the browse button to select a file to upload is a misunderstanding of the API. Selecting a download location for a file is usually a sign that you've not thought through what you're attempting to test.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Collections;
namespace PopupHandler
{
class Program
{
private const int WM_SETTEXT = 0x000C;
public const int WM_SYSCOMMAND = 0x0112;
public const int SC_CLOSE = 0xF060;
public const int BM_CLICK = 0x00F5;
public const int EM_SETPASSWORDCHAR = 0X00CC;
[DllImport("user32.dll")]
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("User32.dll")]
private static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindows);
[DllImport("User32.dll")]
private static extern Int32 SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, StringBuilder lParam);
[DllImport("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
private void HandlePopUp(string browser, string executionmode, string uid, string pwd)
{
if (browser.Equals("ie", StringComparison.InvariantCultureIgnoreCase))
{
if (executionmode.Equals("cancel", StringComparison.InvariantCultureIgnoreCase))
{
// retrieve Windows Security main window handle
IntPtr hWnd = FindWindow("#32770", "Windows Security");
int iterateForSecurityPopup = 0;
for (iterateForSecurityPopup = 0; iterateForSecurityPopup < 20; iterateForSecurityPopup++)
{
hWnd = FindWindow("#32770", "Windows Security");
if (!hWnd.Equals(IntPtr.Zero))
{
SendMessage(hWnd, WM_SYSCOMMAND, SC_CLOSE, 0);
Environment.Exit(0);
}
System.Threading.Thread.Sleep(1000);
}
if (hWnd.Equals(IntPtr.Zero)) {
Console.WriteLine("Dialog with title Security Popup not found");
}
}
else (executionmode.Equals("ok", StringComparison.InvariantCultureIgnoreCase))
{
string[] data = { uid, pwd };
// retrieve Windows Security main window handle
IntPtr hWnd = FindWindow("#32770", "Windows Security");
int iterateForSecurityPopup = 0;
IntPtr duihWnd;
for (iterateForSecurityPopup = 0; iterateForSecurityPopup < 25; iterateForSecurityPopup++)
{
hWnd = FindWindow("#32770", "Windows Security");
if (!hWnd.Equals(IntPtr.Zero))
{
// Get DirectUIHandle
duihWnd = FindWindowEx(hWnd, IntPtr.Zero, "DirectUIHWND", "");
if (!duihWnd.Equals(IntPtr.Zero))
{
ArrayList childs = GetAllChildrenWindowHandles(duihWnd, 15);
int i = 0;
int j = 0;
while (i <= childs.Count)
{
IntPtr edithWnd = FindWindowEx((IntPtr)childs[i], IntPtr.Zero, "Edit", "");
if (!edithWnd.Equals(IntPtr.Zero))
{
// send WM_SETTEXT message to control
SendMessage(edithWnd, WM_SETTEXT, IntPtr.Zero, new StringBuilder(data[j]));
j++;
if (j == 2) { break; }
}
i++;
}
i = 0;
while (i <= childs.Count)
{
//Click on ok
IntPtr btnOkhWnd = FindWindowEx((IntPtr)childs[i], IntPtr.Zero, "Button", "OK");
if (!btnOkhWnd.Equals(IntPtr.Zero))
{
SendMessage(btnOkhWnd, BM_CLICK, 0, 0);
break;
}
i++;
}
}
}
System.Threading.Thread.Sleep(750);
}
if (hWnd.Equals(IntPtr.Zero))
{
Console.WriteLine("Dialog Handle not present");
}
}
}
}
static ArrayList GetAllChildrenWindowHandles(IntPtr hParent, int maxCount)
{
ArrayList result = new ArrayList();
int ct = 0;
IntPtr prevChild = IntPtr.Zero;
IntPtr currChild = IntPtr.Zero;
while (true && ct < maxCount)
{
currChild = FindWindowEx(hParent, prevChild, null, null);
if (currChild == IntPtr.Zero)
{
int errorCode = Marshal.GetLastWin32Error();
break;
}
result.Add(currChild);
prevChild = currChild;
++ct;
}
return result;
}
static void Main(string[] args)
{
string browser = args[0];
string mode = args[1];
string uid = "";
string pwd = "";
uid = args[2];
pwd = args[3];
new Program().HandlePopUp(browser, mode, uid, pwd);
}
}
}
The command line argument would be
ie ok uid pwd
i.e. cancel
Thanks
PD
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/0eb1bc6d-1b58-4593-94a9-2352159d879a%40googlegroups.com.