Reputation: 1968
Not working:
Set checkbox = page.FindChildByXPath("//div[@class='dojoxGridContent']//div[@role='presentation']//div//table//tbody//td//img[@onclick='ChangeCheckbox('" + i + "');']")
Set checkbox = page.FindChildByXPath("//div[@class='dojoxGridContent']//div[@role='presentation']//div//table//tbody//td//img[@onclick='ChangeCheckbox(' + i + ');']")
Can't seem to get the syntax correct.
checkbox
is a Null object after that line is run.
The following works fine:
Set checkbox = page.FindChildByXPath("//div[@class='dojoxGridContent']//div[@role='presentation']//div//table//tbody//td//img[@onclick='ChangeCheckbox(1);']")
I want to be able to substitute the 1
with a variable i
so that I can use different check boxes.
Upvotes: 2
Views: 115
Reputation: 111620
You were wise to make it work with a constant as a sanity check. The rest is so much simpler after that success...
Your working example with a constant,
"blah blah blah CONSTANT blah blah blah"
becomes
"blah blah blah " + VARIABLE + " blah blah blah"
So, in your specific case:
Set checkbox = page.FindChildByXPath("//div[@class='dojoxGridContent']//div[@role='presentation']//div//table//tbody//td//img[@onclick='ChangeCheckbox(" + i + ");']")
Upvotes: 4