Advertisement
Danila_lipatov

selenium_page_turner

Mar 11th, 2025 (edited)
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.24 KB | None | 0 0
  1.          if step != num_pages:
  2.                             if step - int(begin) == 0:
  3.                                  driver.find_element(By.XPATH, '//*[@id="prrFormListResult"]/div[3]/ul/li[2]/a').click()
  4.                                  time.sleep(1)
  5.                                  current_pos.insert(0, '<')
  6.                             elif step - int(begin) == 1:
  7.                                  driver.find_element(By.XPATH, '//*[@id="prrFormListResult"]/div[3]/ul/li[4]/a').click()
  8.                                  time.sleep(1)
  9.                                  current_pos.insert(1, '...')
  10.                             elif step - int(begin) > 1:
  11.                                 driver.find_element(By.XPATH, '//*[@id="prrFormListResult"]/div[3]/ul/li[5]/a').click()
  12.                                 time.sleep(1)
  13.                                 current_pos[3] = step + 1
  14.                                 current_pos[2] = step
  15.                                 current_pos[4] = step + 2
  16.                             elif abs(step - int(end)) == 1:
  17.                                 driver.find_element(By.XPATH, '//*[@id="prrFormListResult"]/div[3]/ul/li[5]/a').click()
  18.                                 time.sleep(1)
  19.                                 current_pos[2] = step
  20.                                 current_pos[3] = step + 1
  21.                                 current_pos.remove('...')
  22.                                 current_pos.remove('>')
  23.  
  24.  
  25.                         if step != num_pages:
  26.                             if step - int(begin) == 0:
  27.                                 wait_.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="prrFormListResult"]/div[3]/ul/li[2]/a'))).click()
  28.                                 wait_.until(EC.invisibility_of_element((By.CLASS_NAME, "prr-form__list-load-img")))
  29.                                 current_pos.insert(0, '<')
  30.  
  31.                             elif step - int(begin) == 1:
  32.                                 wait_.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="prrFormListResult"]/div[3]/ul/li[4]/a'))).click()
  33.                                 wait_.until(EC.invisibility_of_element((By.CLASS_NAME, "prr-form__list-load-img")))
  34.                                 current_pos.insert(1, '...')
  35.  
  36.                             elif step - int(begin) > 1:
  37.                                 wait_.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="prrFormListResult"]/div[3]/ul/li[5]/a'))).click()
  38.                                 wait_.until(EC.invisibility_of_element((By.CLASS_NAME, "prr-form__list-load-img")))
  39.                                 current_pos[3] = step + 1
  40.                                 current_pos[2] = step
  41.                                 current_pos[4] = step + 2
  42.  
  43.                             elif abs(step - int(end)) == 1:
  44.                                 wait_.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="prrFormListResult"]/div[3]/ul/li[5]/a'))).click()
  45.                                 wait_.until(EC.invisibility_of_element((By.CLASS_NAME, "prr-form__list-load-img")))
  46.                                 current_pos[2] = step
  47.                                 current_pos[3] = step + 1
  48.                                 current_pos.remove('...')
  49.                                 current_pos.remove('>')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement