Line length in parlai/mturk/core/test/auto_complete_hit.py.
@@ -10,7 +10,11 @@ try:
from selenium import webdriver
import chromedriver_installer # noqa: F401
except ImportError:
- raise SystemExit("Please make sure your computer has Chrome installed, and then install selenium and chromedriver by running: pip install selenium chromedriver_installer")
+ raise SystemExit(
+ "Please make sure your computer has Chrome installed, and then install "
+ "selenium and chromedriver by running: pip install selenium "
+ "chromedriver_installer"
+ )
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
@@ -39,19 +43,29 @@ driver.get(HIT_page_url)
total_hits_done = 0
-while "There are no HITs in this group available to you at the moment." not in driver.page_source:
+NO_HITS_MSG = "There are no HITs in this group available to you at the moment."
+
+while NO_HITS_MSG not in driver.page_source:
# Click "Accept" button
wait = WebDriverWait(driver, 30)
- accept_button = wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, '''#cookieDependentFunctionality > input[type="image"]''')))
+ accept_button = wait.until(
+ EC.presence_of_element_located(
+ (By.CSS_SELECTOR, '''#cookieDependentFunctionality > input[type="image"]''')
+ )
+ )
time.sleep(random.uniform(2, 10))
print("Clicking on Accept button...")
accept_button.send_keys("\n")
# Wait for main page to show up
- iframe = WebDriverWait(driver, 30).until(EC.presence_of_element_located((By.CSS_SELECTOR, "body > form > iframe")))
+ iframe = WebDriverWait(driver, 30).until(
+ EC.presence_of_element_located((By.CSS_SELECTOR, "body > form > iframe"))
+ )
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
driver.switch_to.frame(iframe)
- input_box = WebDriverWait(driver, 30).until(EC.presence_of_element_located((By.CSS_SELECTOR, "#id_text_input")))
+ input_box = WebDriverWait(driver, 30).until(
+ EC.presence_of_element_located((By.CSS_SELECTOR, "#id_text_input"))
+ )
# Send message
time.sleep(random.uniform(2, 10))
@@ -62,7 +76,9 @@ while "There are no HITs in this group available to you at the moment." not in d
# Click "Done with this HIT" button
wait = WebDriverWait(driver, 30)
- done_button = wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, "#done-button")))
+ done_button = wait.until(
+ EC.visibility_of_element_located((By.CSS_SELECTOR, "#done-button"))
+ )
time.sleep(random.uniform(2, 10))
print("Clicking on Done button...")
done_button.click()
