Page 2 of 2

Re: Trouble selecting a checkbox with usercode

Posted: Thu Jun 11, 2015 6:59 pm
by AdamMackintosh
OMG I fixed it!

The problem was the path to that delete button was too specific somehow, so I made it a bit looser and it instantly worked :)

Here is my working code:
public void Validate_TrackTable()
        {
 			IList<Ranorex.ATag> foundTags = repo.VoloMP.TrackTable.Find<Ranorex.ATag>(@".//input[@tagvalue~'nhd6mid.BG6uvr7i']/../..//a[@id='deleteMe']");  
 			Report.Log(ReportLevel.Info, "Test", "Table grabbed.", repo.VoloMP.TrackTableInfo);
    		foreach (ATag curATag in foundTags)   
    		{  
		        curATag.PerformClick();  
		        Report.Log(ReportLevel.Info, "Test", "We should see 3 of these: "+curATag.InnerText, repo.VoloMP.TrackTableInfo);
	    	}  
        }
Here is my log output, which is exactly how it should have looked:
00:02.358 Info Test Table grabbed.
00:02.387 Info Test We should see 3 of these: delete
00:02.416 Info Test We should see 3 of these: delete
00:02.443 Info Test We should see 3 of these: delete
It also clicks on the 3 delete buttons it was supposed to, so extreme thanks to odklizec. I couldn't have done it without you.

-Adam

Re: Trouble selecting a checkbox with usercode

Posted: Thu Jun 11, 2015 7:01 pm
by AdamMackintosh
odklizec wrote:Hi,

I believe you forgot to escape "." in changed xpath. This code shoud work...
IList<Ranorex.ATag> foundTags = repo.VoloMP.TrackTable.Find<Ranorex.ATag>(@".//input[@tagvalue~'nhd6mid\.BG6uvr7i']/../..//a[#deleteMe]");

WHen i put that path fragment into SPy, it was alwasy returning only the first match, so I did some diagnosis and found a way to get all 9 delete buttons, then i cleaned it up as you can see in my previous post to match the 3 that I wanted.

There is actually two delete buttons in each row, so I had to use /a[@id='deleteMe'] to zoom in on the correct one. That was the specific change that fixed everything.

Re: Trouble selecting a checkbox with usercode

Posted: Thu Jun 11, 2015 7:06 pm
by odklizec
Hm, that's weird. I believe I tried it with escaped string and it worked for me, while it didn't work at all with unescaped string? Anyway, good to hear you solved it. I'm glad I could help :)