Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

151
Views
Protractor scan source code looking for ANY element from Array - like Ruby loop do

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
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!