This is a migrated thread and some comments may be shown as answers.

Not able to identify email box from gmail.com

3 Answers 57 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sunil
Top achievements
Rank 1
Sunil asked on 03 Sep 2013, 11:23 AM
                Settings mySettings = new Settings();
            mySettings.Web.DefaultBrowser = BrowserType.FireFox;
            Manager myManager = new Manager(mySettings);
            myManager.Start();
            myManager.LaunchNewBrowser();
            myManager.ActiveBrowser.NavigateTo("http://www.gmail.com");
            System.Threading.Thread.Sleep(8000);
            HtmlFindExpression expression = new HtmlFindExpression("Name = Email", "id = Email");
            HtmlInputEmail emal = myManager.ActiveBrowser.Find.ByExpression<HtmlInputEmail>(expression);
Not able to identify the email text box in gmail.com, please let me know if anything I am missing in my code, thanks!

3 Answers, 1 is accepted

Sort by
0
Velin Koychev
Telerik team
answered on 06 Sep 2013, 11:55 AM
Hello Sunil,

I am sorry to hear that  you are experiencing this issue.


I have made some small changes in your code and now it should work:
Settings mySettings = new Settings();
mySettings.Web.DefaultBrowser = BrowserType.FireFox;
Manager myManager = new Manager(mySettings);
myManager.Start();
myManager.LaunchNewBrowser();
myManager.ActiveBrowser.NavigateTo("http://www.gmail.com");
System.Threading.Thread.Sleep(8000);
HtmlFindExpression expression = new HtmlFindExpression("id=Email", "tagname=input");
myManager.ActiveBrowser.RefreshDomTree();
HtmlInputEmail emal = myManager.ActiveBrowser.Find.ByExpression<HtmlInputEmail>(expression);

You should use "id=Email", "tagname=input" for find expression

I have recorded a short video for demonstration. 

Let me know if this works. 

Regards,
Velin Koychev
Telerik
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Sunil
Top achievements
Rank 1
answered on 18 Sep 2013, 12:13 PM
Thanks for the reply!
After the above code, I am trying to enter some value on the email box like below code, but unable to identify the email box even with tagname and id...

Settings mySettings = new Settings();
            mySettings.Web.DefaultBrowser = BrowserType.FireFox;
            Manager myManager = new Manager(mySettings);
            myManager.Start();
            //List<Browser> browsers = new List<Browser>;
            //browsers = myManager.Desktop.
            myManager.LaunchNewBrowser();
            myManager.ActiveBrowser.NavigateTo("http://www.gmail.com");
            System.Threading.Thread.Sleep(8000);
 
            HtmlFindExpression expression = new HtmlFindExpression("id=Email", "tagname=input");
            myManager.ActiveBrowser.RefreshDomTree();
 
            HtmlInputEmail emal = myManager.ActiveBrowser.Find.ByExpression<HtmlInputEmail>(expression);
            emal.Value = "sunilpatro1985";  //emal returns a null value and getting error as object reference not found on run
Please help regarding this, I am not sure if missing something as this is just my start to this framework, thanks
0
Accepted
Velin Koychev
Telerik team
answered on 18 Sep 2013, 01:07 PM
Hello Sunil,

In order to achieve this, you need to change  emal.Value = "sunilpatro1985";  with the following line of code:

myManager.ActiveBrowser.Actions.SetText(emal, "sunilpatro1985");

I've recorded a short video for demonstration.

I hope this helps.

Regards,
Velin Koychev
Telerik
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Sunil
Top achievements
Rank 1
Answers by
Velin Koychev
Telerik team
Sunil
Top achievements
Rank 1
Share this question
or