gpt4 book ai didi

java - 使用selenium java的字体颜色

转载 作者:行者123 更新时间:2023-12-01 11:28:45 25 4
gpt4 key购买 nike

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

为什么没有从我的代码中检索字体颜色和字体类型?

最佳答案

使用colorfont-family代替font-color和font-type。

关于java - 使用selenium java的字体颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30612149/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com