I build a test case using the code modules to allow me to log into a site. The form authentication popup window displays username and password before getting into the site. The code below works fine with Internet Explorer but when trying to set the text values for firefox browser it displays an error.
The Error: Setting attribute 'text' failed on element '{Text:User Name:}'.
The operation is not supported.
The method or operation is not implemented.
Code Below
Form f ="/form";
if(getExplorer == "IExplore.exe")
{
f ="/form[@title='Windows Security']";
}
if (getExplorer == "firefox.exe")
{
f ="/form[@title='Authentication Required']";
}
IList<Text> tag = f.Find<Text>(".//text");
//Windows Security
for(int i=0; i < tag.Count; i++)
{
Regex dr = new Regex(@"(user name)");
Regex pw = new Regex(@"(password)");
Match m = dr.Match(tag.ToString().ToLower());
Match m2 = pw.Match(tag.ToString().ToLower());
if(m.Success){
tag.TextValue="";
}
if(m2.Success){
tag.TextValue="";
}
}
CheckBox check = f.FindSingle("//checkbox[@accessiblename='Remember my credentials']");
check.Check();
Button b = f.FindSingle("//button[@accessiblename='OK']");
b.Click();
Firefox Authentication Form
Firefox Authentication Form
Last edited by jonesj on Tue Oct 29, 2013 4:06 pm, edited 1 time in total.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Firefox Authentication Form
Hello,
I would recommend to use the "domain" adapter instead of the "form" adapter. Your text box should be an input tag.
Regards,
Bernhard
I would recommend to use the "domain" adapter instead of the "form" adapter. Your text box should be an input tag.
InputTag tag = @"/dom[@domain='www.domain.com']//input[@name='YourInputTag']"; tag.TagValue="YourText";This should work.
Regards,
Bernhard
Re: Firefox Authentication Form
When navigating from google to the desire site, the windows authentication window pops up. It just sits in idle and when I click cancel it then moves onto the rest of the code.
Now when I just load the site without navigating it works.
What is webdocument doing for it to just sit there waiting on input or some action?
My reasons for changing it because when I use data driven tests and it loads the site, sometimes the other code modules will execute before the explorer is finish loading.
void ITestModule.Run()
{
Mouse.DefaultMoveTime = 300;
Keyboard.DefaultKeyPressTime = 100;
Delay.SpeedFactor = 1.0;
//Delay.Duration(1);
Thread.Sleep(500);
// Start IE with a specific website
Host.Local.OpenBrowser("", "IE",true,true);
WebDocument webdocument = "/dom[@caption='Google'']";
webdocument.Navigate("site");
var iexplore = System.Diagnostics.Process.GetProcessesByName("IExplore");
Form f ="/form";
if(iexplore.Length<=1)
{
if(getExplorer == "IExplore.exe")
{
f ="/form[@title='Windows Security']";
}
if (getExplorer == "firefox.exe")
{
f ="/form[@title='Authentication Required']";
}
if(getExplorer!="chrome.exe")
{
IList<Text> tag = f.Find<Text>(".//text");
//Windows Security
for(int i=0; i < tag.Count; i++)
{
Regex dr = new Regex(@"(user name)");
Regex pw = new Regex(@"(password)");
Match m = dr.Match(tag.ToString().ToLower());
Match m2 = pw.Match(tag.ToString().ToLower());
if(m.Success){
tag.TextValue="";
}
if(m2.Success){
tag.TextValue="";
}
}
CheckBox check = f.FindSingle("//checkbox[@accessiblename='Remember my credentials']");
check.Check();
Thread.Sleep(100);
Button b = f.FindSingle("//button[@accessiblename='OK']");
b.Press();
}
}
}
Now when I just load the site without navigating it works.
What is webdocument doing for it to just sit there waiting on input or some action?
My reasons for changing it because when I use data driven tests and it loads the site, sometimes the other code modules will execute before the explorer is finish loading.
void ITestModule.Run()
{
Mouse.DefaultMoveTime = 300;
Keyboard.DefaultKeyPressTime = 100;
Delay.SpeedFactor = 1.0;
//Delay.Duration(1);
Thread.Sleep(500);
// Start IE with a specific website
Host.Local.OpenBrowser("", "IE",true,true);
WebDocument webdocument = "/dom[@caption='Google'']";
webdocument.Navigate("site");
var iexplore = System.Diagnostics.Process.GetProcessesByName("IExplore");
Form f ="/form";
if(iexplore.Length<=1)
{
if(getExplorer == "IExplore.exe")
{
f ="/form[@title='Windows Security']";
}
if (getExplorer == "firefox.exe")
{
f ="/form[@title='Authentication Required']";
}
if(getExplorer!="chrome.exe")
{
IList<Text> tag = f.Find<Text>(".//text");
//Windows Security
for(int i=0; i < tag.Count; i++)
{
Regex dr = new Regex(@"(user name)");
Regex pw = new Regex(@"(password)");
Match m = dr.Match(tag.ToString().ToLower());
Match m2 = pw.Match(tag.ToString().ToLower());
if(m.Success){
tag.TextValue="";
}
if(m2.Success){
tag.TextValue="";
}
}
CheckBox check = f.FindSingle("//checkbox[@accessiblename='Remember my credentials']");
check.Check();
Thread.Sleep(100);
Button b = f.FindSingle("//button[@accessiblename='OK']");
b.Press();
}
}
}
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Firefox Authentication Form
Hi,
If so, the method waits an infinite timeout for the document to be loaded. For more information about the method please take a look at our online API: WebDocument.Navigate().
Is it also possible to define a timeout ("Specifies the maximum time to wait for the document to be loaded.").
Regards,
Markus
I assume you refer to the "webdocument.Navigate()" method.What is webdocument doing for it to just sit there waiting on input or some action?
If so, the method waits an infinite timeout for the document to be loaded. For more information about the method please take a look at our online API: WebDocument.Navigate().
Is it also possible to define a timeout ("Specifies the maximum time to wait for the document to be loaded.").
Regards,
Markus