How to check whether a text is underlined or not in a webpage using Selenium Webdriver

0 votes

How to check whether a text is underlined or not in a webpage using webdriver?

May 31, 2019 in Selenium by Kamal
8,406 views

1 answer to this question.

0 votes

Hey Kamal, you can use following code snippet to check whether a text is underlined or not. But first you need to identify the underlined property. You can Identify by getCssValue(“border-bottom”) or sometime getCssValue(“text-decoration”) method if the cssValue is 'underline' for that WebElement or not.

 public class UnderLine {

 public static void main(String[] args) {

 WebDriver driver = new FirefoxDriver();

 driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

 driver.get("https://www.google.co.in/?gfe_rd=ctrl&ei=bXAwU8jYN4W6iAf8zIDgDA&gws_rd=cr");

 String cssValue= driver.findElement(By.xpath("//a[text()='Hindi']")).getCssValue("text-decoration");

 System.out.println("value"+cssValue);

 Actions act = new Actions(driver);

 act.moveToElement(driver.findElement(By.xpath("//a[text()='Hindi']"))).perform();

 String cssValue1= driver.findElement(By.xpath("//a[text()='Hindi']")).getCssValue("text-decoration");

 System.out.println("value over"+cssValue1);

 driver.close();

 }

 }
answered May 31, 2019 by Abha
• 28,140 points

Related Questions In Selenium

0 votes
1 answer
0 votes
1 answer
+1 vote
2 answers

Is it possible to scroll down in a webpage using selenium webdriver programmed on python?

I using next code for facebook for ...READ MORE

answered May 16, 2019 in Selenium by mslavikas@gmail.com
26,072 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
13,672 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,142 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
7,220 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,872 views
0 votes
1 answer

How to type text in a new line inside a text area using Selenium Webdriver?

Hey Unnati, '\n' is usually used to type text ...READ MORE

answered Jun 25, 2019 in Selenium by Abha
• 28,140 points
13,943 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP