简体   繁体   中英

font color using selenium java

WebDriver driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.get("https://news.google.co.in/nwshp?hl=en&tab=wn&ei=zJBuVe3MGYukuQTrlIDAAQ&ved=0CAUQqS4oBQ");
driver.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS);  
driver.findElement(By.id("gbqfq")).sendKeys("Veenita");
System.out.println("Font Size is "+ driver.findElement(By.id("gbqfq")).getCssValue("font-size"));
System.out.println("Font Color is "+driver.findElement(By.id("gbqfq")).getCssValue("font-color"));
System.out.println("Font Background Color is "+driver.findElement(By.id("gbqfq")).getCssValue("background-color"));
System.out.println("Font Type is "+driver.findElement(By.id("gbqfq")).getCssValue("font-type"));

O/P is:

Font Size is 16px
Font Color is 
Font Background Color is transparent
Font Type is 

Why font color and font type is not getting retrieved from my code?

使用colorfont-family而不是font-color和font-type。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM