Hi,
I am stuck at one scenario.
I want to test the on / off or in other words Enabled / Disabled status of toggle button in my web application using robot framework. In both of / off status I am getting same web element so it is getting hard to handle it. Any solution? I am using robot framework / Python / Selenium.
Below are Xpath and full xpath which is same when toggle is enabled or disabled.
//*[@id=“tabTest”]/div[2]/div[2]/div[2]/label
/html/body/div[2]/div[2]/div[4]/div[1]/div[2]/div/div[1]/div[2]/div[2]/div[2]/label
Maybe you could have taken a html screenshot for 2 buttons (one on and one off) so we could check for differences.
BTW, that xpath is awfull, it is not at all reliable.
Below code is worked for me for me to get background color of toggle button. It will helpful to take the action based on toggle buttonenabled(Green in color) and disabled(Grey in color) .
${BG} Get WebElement xpath=(//span[@class="slider round"])[3]
${bg color} Call Method ${BG} value_of_css_property background-color
Run Keyword If '${bg color}' == 'rgba(204, 204, 204, 1)'
... Click Element xpath=(//span[@class="slider round"])[3]
... ELSE
... Click Element xpath=//*[@id="app"]/div[2]/div[4]/div[1]/div[1]/div/div/ul/li[2]/a