I need to scan a page in an infinite loop looking for element of an Array , keep refreshing until found and break. I cannot get it to work in JS
in Ruby my code looked like this ( after page remastering no longer works ) I do't know how to reference page source. I have found browser.isElementPresent(), but I cannot get it to work either.
Every help would be much appreciated. Thanks
POSTCODES = [' TN1 ', ' TN2 ', ' TN3 ', ' TN4 ', ' TN10 ',' TN11 ',' TN12 ',
' TN15 ', ' TN17 ',' TN18 ',' TN19 ',' TN23 ',' TN24 ',
' TN25 ', ' TN26 ',' TN27 ',' ME1 ', ' ME2 ', ' ME3 ', ' ME4 ', ' ME5 ',
' ME6 ', ' ME7 ', ' ME8 ', ' ME9 ', ' ME10 ',' ME11 ',' ME12 ',' ME13 ',
' ME14 ', ' ME15 ',' ME16 ',' ME17 ',' ME18 ',' ME19 ',' ME20 ',' CT1 ',
' CT2 ', ' CT3 ', ' CT4 ', ' CT21 ']
loop do
driver.get "https://..."
if POSTCODES.any? {|pc| @a = pc if driver.page_source.include?(pc)}
driver.manage.window.maximize
break
end
sleep rand(0.3...0.51)
end