I am using ruby with selenium and my code is as follows:
$num=1
def isElementPresent(xpathExpression)
[email protected]_elements(:xpath,xpathExpression)
if (allElements.size==0)
return true
end
else
return false
end
while Demo.isElementPresent(str1+$num.to_s+str2)
[email protected]_element(:xpath,str1+$num.to_s+str2).text
$num+=1
puts "text is:#{text}"
@driver.find_element(:xpath,str1+$num.to_s+str2).click
puts @driver.title
@driver.navigate.back
end
end
I'm getting an undefined method error for while Demo.isElementPresent(str1+$num.to_s+str2).
Any help is appreciated