Click on disabled button

Ask general questions here.
xianghuai
Posts: 1
Joined: Tue Jun 16, 2015 9:57 pm

Click on disabled button

Post by xianghuai » Tue Jun 16, 2015 10:25 pm

After making a recording, I changed the application by disabling a button that has been clicked on during the recording. When I run the test case again, it should fail when trying to click on the disabled button. However, it went on as the button is still enabled. Why? Thanks.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Click on disabled button

Post by odklizec » Wed Jun 17, 2015 12:43 pm

Hi,

Unless you extend button's xpath with @enabled='True', it will try to click it regardless of enabled state. However, adding @enabled='True' to the xpath could make your script to fail in case the button remains disabled.

You will have to use a condition (via code) that Ranorex should click only enabled button. Something like this:
if (repo.yourbutton.Enabled)
            {
            	repo.yourbutton.Click();
            }
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration