2

I am using Robot Framework and Selenium2Library. I am trying to check that given element is disabled. Code used is :

Element Should Be Disabled | //div[6]/div[2]/div/div[2]/div[1]/div[2]/div/div/div[2]/div[2]/span[4]

This code is giving me following error :

ERROR: Element //div[6]/div[2]/div/div[2]/div[1]/div[2]/div/div/div[2]/div[2]/span[4] is not an input.

Help in solving this problem would be appreciated. Thanks !!

Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685

2 Answers2

2

What I did was Used the "Get Element Attribute" keyword on the id of the element follow by the attribute I wanted to access so here it would be @disabled Get Element Attribute|id@disabled and stored it as a variable. You can then check if the value of that variable is disabled or not. Hope this is helpful

1

The error is clear: Element ... is not an input.

The keyword is expecting an <input/> element.

Helio
  • 3,322
  • 1
  • 14
  • 23
  • If I understand your answer correctly, you're implying that "disabled" is a property of an ``-type HTML element, and as such if an HTML element is not an `` element, it cannot be "disabled", is that correct? – Brandon Olson Oct 05 '17 at 15:31
  • 1
    That is not correct. It is known that `` elements have the @disabled=[true|false] attribute, and probably the keyword is looking for it. Even so, if your `` element did have the @disabled attribute, the keyword could fail because probably was designed to look only for ``. – Helio Oct 05 '17 at 17:08
  • That is essentially what I was getting at, but thank you for the clarification. – Brandon Olson Oct 05 '17 at 17:49