user2404845
user2404845

Reputation: 51

how to verify style attribute in Selenium IDE

I have the following code:

<div class="ui-multiselect-menu ui-widget ui-widget-content ui-corner-all ui-multiselect-single" style="width: 192px; top: 172px; left: 299.9px; display: none;">

how can i use verifyAttribute or any other command to validate that the style is display: none; ? the xpath that I have is /html/body/div[3]

Upvotes: 5

Views: 6046

Answers (3)

mjaque
mjaque

Reputation: 502

You can store the attribute value and verify it.

For example, to check style attribute on span in td:

1. Store attribute value in variable:
Command: store atribute
Target: css=tr:nth-child(2) > td:nth-child(3) > span@style
(you can also use xpath here)
Value: estilo

2. Check it with echo (for spaces, colons...):
Command: echo
Target: ${estilo}

3. And verify or assert it:
Command: assert
Target: estilo
Value: color: rgb(111, 235, 10);

Upvotes: 0

user3303268
user3303268

Reputation: 21

Better late then never...

Command: assertAttribute
Target: css=#div_id@style
Value: display: none

Upvotes: 2

Laksitha Ranasingha
Laksitha Ranasingha

Reputation: 4507

You have to match your style attribute with xpath contains, for example //*[contains(@style,'display: none')] this means any element which has display: none. you can further refine it like //div[contains(@style,'display: none')]

Upvotes: 2

Related Questions