100<\" in the DOM (HTM" />
开发者

Trying to validate the background property of an object when it is in the CSS style

  • Ruby version 1.9.2
  • gem version 1.8.1
  • IE version 8 in compatibility mode

I have an object on the page (is actually a cell in a table) that is defined as a "TD class=burst>100<" in the DOM (HTML). There is a CSS attached as well with several style properties for that object (e.g. color, text-align). The CSS style code looks like the following:

 DIV.points TD.burst 
    text-align : center
    width : 55px
      ...
    background : url(xxxx.png) no-repeat 50% 0px
    color : #fff
      ...

The style background property of the o开发者_如何转开发bject is displaying an image on the page.

I am trying to validate that the correct image is being displayed using watir, so I am trying to retrieve the background property:

 image_id = $ie.cell(:class=>"burst",:index=>1).style.background

I am getting a method_missing': unknown property or method: `background' (NoMethodError) error.

I am able to get other properties like:

 image_id = $ie.cell(:class=>"burst",:index=>1).style.width
 image_id = $ie.cell(:class=>"burst",:index=>1).style.color

The same results occur for currentstyle.

Does anyone know a way I would be able to access the background property/method of the object when it is in the CSS style?


I was able to access the information I needed by using the backgroundimage property instead of the background property (since the background property is made up of several properties including the backgroundimage property).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜