Unable to switch tabs in Firefox

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Unable to switch tabs in Firefox

Bhavin Shah
Hello,

I have written a code to verify logged in user name (first+last) but as arrow is there I am not able to do so. Can anyone pls help me out ? (Refer attachment)

Below is the code I have written

String expected = "Anjana Sharma";
WebElement rs = driver.findElement(By.xpath(".//*[@id='side-menu']/li[1]/div[1]/a/span/span/strong"));
      String actual = rs.getText();
      if(expected.equals(actual))
         {
       System.out.println("Test Case is Passed");   
         }
          else {
         System.out.println("Test Case is Failed");  
       }


Regards,
Bhavin

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAHp3d77OaqkwR7HzHwh7QUt1JbNTogwwDQVwH6BpByB2ZWd-cA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

ref img -01.jpg (139K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Unable to switch tabs in Firefox

Bhavin Shah
Hello All,

I have written a code to verify logged in user name (first+last) and whenever I execute the below code fragment it is giving me result 'Test Case is Failed', made many attempts by changing xpath/locator but did not help may be as arrow is there I am unable to do so. How to truncate to take only the text and not downward pointing arrow. Can anyone pls help me out ? (Refer attachment). Also I want to print error/warning messages in console but it is not happening so... How should I work it our ?

Code fragment

String expected = "Anjana Sharma";
WebElement rs = driver.findElement(By.xpath(".//*[@id='side-menu']/li[1]/div[1]/a/span/span/strong"));
String actual = rs.getText();
  if(expected.equals(actual))
         {
       System.out.println("Test Case is Passed");   
         }
          else {
            System.out.println("Test Case is Failed");  
       }


Regards,
Bhavin

On Fri, May 18, 2018 at 11:16 AM, Bhavin Shah <[hidden email]> wrote:
Hello,

I have written a code to verify logged in user name (first+last) but as arrow is there I am not able to do so. Can anyone pls help me out ? (Refer attachment)

Below is the code I have written

String expected = "Anjana Sharma";
WebElement rs = driver.findElement(By.xpath(".//*[@id='side-menu']/li[1]/div[1]/a/span/span/strong"));
      String actual = rs.getText();
      if(expected.equals(actual))
         {
       System.out.println("Test Case is Passed");   
         }
          else {
         System.out.println("Test Case is Failed");  
       }


Regards,
Bhavin

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAHp3d75Szz71-g%2B7ZsQ46CWM%2B345g3BOFY-HA5Y5vja_nKZYPw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

ref img -01.jpg (139K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Unable to switch tabs in Firefox

Krishnan Mahadevan

Try with:

 

String actual = ((String) driver.executeScript(“return arguments[0].innerHTML;”, rs)).trim();

 

And see if that helps.

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

 

From: <[hidden email]> on behalf of Bhavin Shah <[hidden email]>
Reply-To: <[hidden email]>
Date: Wednesday, May 23, 2018 at 1:52 PM
To: <[hidden email]>
Subject: [selenium-users] Re: Unable to switch tabs in Firefox

 

Hello All,

 

I have written a code to verify logged in user name (first+last) and whenever I execute the below code fragment it is giving me result 'Test Case is Failed', made many attempts by changing xpath/locator but did not help may be as arrow is there I am unable to do so. How to truncate to take only the text and not downward pointing arrow. Can anyone pls help me out ? (Refer attachment). Also I want to print error/warning messages in console but it is not happening so... How should I work it our ?

 

Code fragment

 

String expected = "Anjana Sharma";

WebElement rs = driver.findElement(By.xpath(".//*[@id='side-menu']/li[1]/div[1]/a/span/span/strong"));

String actual = rs.getText();

  if(expected.equals(actual))

         {

       System.out.println("Test Case is Passed");   

         }

          else {

            System.out.println("Test Case is Failed");  

       }

 


Regards,

Bhavin

 

On Fri, May 18, 2018 at 11:16 AM, Bhavin Shah <[hidden email]> wrote:

Hello,

 

I have written a code to verify logged in user name (first+last) but as arrow is there I am not able to do so. Can anyone pls help me out ? (Refer attachment)

 

Below is the code I have written

 

String expected = "Anjana Sharma";

WebElement rs = driver.findElement(By.xpath(".//*[@id='side-menu']/li[1]/div[1]/a/span/span/strong"));

      String actual = rs.getText();

      if(expected.equals(actual))

         {

       System.out.println("Test Case is Passed");   

         }

          else {

         System.out.println("Test Case is Failed");  

       }

 


Regards,

Bhavin

 

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAHp3d75Szz71-g%2B7ZsQ46CWM%2B345g3BOFY-HA5Y5vja_nKZYPw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/25E6D440-DEF3-456E-BF39-1F6FC1733692%40gmail.com.
For more options, visit https://groups.google.com/d/optout.