【问题标题】:Selenium WebDriver getCssValue() is not returning anything for background-repeat-xSelenium WebDriver getCssValue() 没有为 background-repeat-x 返回任何内容
【发布时间】:2013-05-02 11:34:51
【问题描述】:

我正在尝试验证背景图像是否存在以及该属性是否设置为对 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);

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

【问题讨论】:

    标签: java css selenium selenium-webdriver


    【解决方案1】:

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

    【讨论】:

    • 啊哈!是的你可以。太棒了,我可以解析那个结果。太棒了!
    猜你喜欢
    • 1970-01-01
    • 2013-06-19
    • 2018-07-30
    • 2020-12-20
    • 2016-06-23
    • 2018-04-05
    • 1970-01-01
    • 1970-01-01
    • 2021-01-01
    相关资源
    最近更新 更多