Selenium WebDriver getCssValue()不返回任何background-repeat-x [英] Selenium WebDriver getCssValue() is not returning anything for background-repeat-x

查看:130
本文介绍了Selenium WebDriver getCssValue()不返回任何background-repeat-x的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试验证背景图片是否存在,并且该属性已设置为对x重复。



使用

  driver.findElement(By.xpath(// body)。getCssValue(background-image); 
< c $ c>



返回我可以解析的东西,所以我都很好。



但是,当我尝试获取repeat-x属性,我没有输出:

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

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' p>

I'm attempting to verify that a background image is present and that the property is set to repeat for x.

Getting the image with

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

returns something I can parse so I'm all good there.

However, when I try to get the repeat-x property, I get no output:

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

The css, as seen in element viewer in Chrome, looks like this:

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);

Any help, gratefully received. Thanks.

解决方案

Can you test the value of the 'background-repeat' property is 'repeat no-repeat' ?

这篇关于Selenium WebDriver getCssValue()不返回任何background-repeat-x的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆