gpt4 book ai didi

java - Selenium WebDriver getCssValue() 没有为 background-repeat-x 返回任何东西

转载 作者:太空宇宙 更新时间:2023-11-04 15:01:53 25 4
gpt4 key购买 nike

我正在尝试验证背景图像是否存在以及该属性是否设置为重复 x。

获取图像

driver.findElement(By.xpath("//body").getCssValue("background-image");

返回一些我可以解析的东西,所以我对此很满意。

但是,当我尝试获取 repeat-x 属性时,我没有得到任何输出:

driver.findElement(By.xpath("//body").getCssValue("background-repeat-x");

在 Chrome 的元素查看器中看到的 css 看起来像这样:

background: #213A6A url('/images/background.png') repeat-x top;
background-image: url(http://mysite/images/background.png);
background-position-x: 50%;
background-position-y: 0%;
background-size: initial;
background-repeat-x: repeat;
background-repeat-y: no-repeat;
background-attachment: initial;
background-origin: initial;
background-clip: initial;
background-color: rgb(33, 58, 106);

任何帮助,感激不尽。谢谢。

最佳答案

你能测试'background-repeat'属性的值是'repeat no-repeat'吗?

关于java - Selenium WebDriver getCssValue() 没有为 background-repeat-x 返回任何东西,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16337043/

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