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 是:
Font Size is 16px
Font Color is
Font Background Color is transparent
Font Type is
为什么不从我的代码中检索字体颜色和字体类型?
答案 0 :(得分:1)
使用color
和font-family
代替font-color和font-type。