Not able to identify email box from gmail.com

4 posts, 1 answers
  1. Sunil
    Sunil avatar
    3 posts
    Member since:
    Mar 2013

    Posted 03 Sep 2013 Link to this post

                    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!
  2. Velin Koychev
    Admin
    Velin Koychev avatar
    88 posts

    Posted 06 Sep 2013 Link to this post

    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
  3. Sunil
    Sunil avatar
    3 posts
    Member since:
    Mar 2013

    Posted 18 Sep 2013 Link to this post

    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
  4. Answer
    Velin Koychev
    Admin
    Velin Koychev avatar
    88 posts

    Posted 18 Sep 2013 Link to this post

    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
Back to Top