0
votes

Below is the sample tag

I would need an output for the style attribute which is "padding-left:16px;;" Tried @browser.td(:class, "xxxx").attribute_value("style") and the output I get is "" where as I was expecting "padding-left:16px;;" Any help is appreciated.

1
sample tag <td class="xxxx" id="1234" style="padding-left:16px;;" ai="[&quot;c6874842903c9bed3_OP_alc195fa2647f1625b&quot;]"> - TGR
Are there multiple td elements with that class? Note that @browser.td(:class, "xxxx") returns the first matching element. The one you are looking for might not be the first one on the page, which is why you do not get the expected value. - Justin Ko
Yes Justin you are absolutely right, it has multiple td elements with the same class. Thanks for letting me know why it didn't give me the expected result - TGR

1 Answers

0
votes

Use the .style method

padding_left = @browser.td(:class, "xxxx").style('padding-left')