Esempio n. 1
0
 def change_password(self, new_password):
     #!!!!!NOT TESTED YET!!!!!!
     # https://www.kartable.fr/compte/informations-personnelles/modifier-mot-de-passe
     helium.write(self.password, into="Mot de passe actuel")
     helium.write(new_password, into="Nouveau mot de passe")
     helium.write(new_password, into="Ressaisir nouveau mot de passe")
     helium.click("mettre à jour")
Esempio n. 2
0
def get_interactive_page_source(url):
    """Obtém código-fonte completo da página."""
    # inicia o chrome para renderizar o código-fonte
    try:
        start_chrome(url, headless=True)
    except Exception:
        print(
            "Erro: você precisa instalar o Google Chrome e o ChromeDriver par"
            "a executar esse raspador.")
        sys.exit(1)

    driver = get_driver()

    # clica em todos os botões "Veja mais!" para liberar os dados dos resumos
    print(
        f"Raspando a página \"{driver.title}\". Isso pode demorar alguns segundos..."
    )
    buttons = find_all(S("//span[@onClick]"))
    for _ in tqdm(range(len(buttons))):
        click("Veja mais!")
    print('Fim da raspagem da página.')

    # obtém objeto soup a partir do código-fonte renderizado pelo helium
    soup = BeautifulSoup(driver.page_source, 'html.parser')

    # fecha o chrome
    kill_browser()

    return soup
Esempio n. 3
0
 def test_click_text_implicit_wait(self):
     click("Click me!")
     start_time = time()
     click("Now click me!")
     end_time = time()
     self.assertEqual('Success!', self.read_result_from_browser())
     self.assertGreaterEqual(end_time - start_time, 3.0)
Esempio n. 4
0
 def levels(self):
     return "Not implemented yet"
     """https://www.kartable.fr/{classe}"""
     helium.click(self.current_level)
     m = list(set(
         [i.text for i in self.driver.find_elements_by_class_name("school-year__level")]))
     self.driver.find_element_by_class_name("icon-close").click()
Esempio n. 5
0
def login_connpass():
    """connpassにログインする(ユーザー名とパスワードは環境変数を想定)"""
    go_to("connpass.com/login")
    write(os.getenv("CONNPASS_USERNAME"), into="ユーザー名")
    write(os.getenv("CONNPASS_PASSWORD"), into="パスワード")
    click("ログインする")

    wait_until(Text("あなたのイベント").exists)
Esempio n. 6
0
 def join_school(self):
     #!!!!!NOT TESTED YET!!!!!!
     self.driver.get(
         "https://www.kartable.fr/classe?navigationOrigin=ruby-quest")
     helium.write(self.ecole, into="Rechercher un établissement...")
     select = Select(self.driver.find_element_by_tag_name('select'))
     select.select_by_value('1')  # select the first
     helium.click("rejoindre")
     self.driver.find_element_by_class_name("icon-close").click()
Esempio n. 7
0
def scroll_results_page(driver):
    end = False
    while not end:
        try:
            driver.execute_script(
                'window.scrollTo(0, document.body.scrollHeight);')
            helium.click('Show more matches')
            time.sleep(2)
        except LookupError:
            end = True
Esempio n. 8
0
def joinf():
    if Text("Partecipa").exists():
        click("Partecipa")
        print(colorama.Fore.GREEN + colorama.Style.BRIGHT +
              "You're in the Meet!")
    elif Text("Chiedi di partecipare").exists():
        click("Chiedi di partecipare")
        print(colorama.Fore.WHITE + colorama.Style.BRIGHT +
              "Waiting for the host to accept you")
    ref()
Esempio n. 9
0
 def test_recover_pass_with_invalid_user(self):
     driver = helium.start_chrome('https://goantifraud.com/manager',
                                  headless=True)
     helium.click('Forgot your password?')
     helium.write(TEST_DATA['invalid_credentials']['log'], into='login')
     helium.click('SEND')
     time.sleep(0.5)
     validation_msg_list = helium.find_all(helium.S(".error.error_show"))
     helium.kill_browser()
     self.assertEqual(len(validation_msg_list), 2)
Esempio n. 10
0
    def run(self, dispatcher: CollectingDispatcher, tracker: Tracker,
            domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:

        element_name = tracker.get_slot('element_name')
        if element_name:
            click(element_name)
            tracker.slots = {'element_name': ''}
            dispatcher.utter_message("已点击")

        else:
            dispatcher.utter_message("抱歉,无法识别元素名称")
        return []
Esempio n. 11
0
def submit_request(song,
                   artist,
                   url='www.harmonixmusic.com/games/rock-band/request'):
    "Uses helium framework to open chrome, open a website, and submit a song"

    logging.info("Logging into %s", url)
    start_chrome(url, headless=True)
    write(song, into='Song Title')
    write(artist, into='Artist')
    logging.info("Submitting request for '%s' by '%s'", song, artist)
    click('Submit')
    kill_browser()
Esempio n. 12
0
def getDemons(name):
    list1 = []
    list0 = []
    start_chrome('https://pointercrate.com/demonlist/')
    press(END)
    press(PAGE_UP)
    click('Open the stats viewer!')
    write(name, into='Enter to search...')
    click(name)
    time.sleep(1)
    main_is_empty = 1
    extended_is_empty = 1
    mainverifs_is_empty = 1
    extendedverifs_is_empty = 1
    for x in range(75):
        counter = x + 1
        if main_is_empty:
            mainlist = find_all(S('//*[@id="beaten"]/b[%d]/a' % (counter)))
        if extended_is_empty:
            extendedlist = find_all(
                S('//*[@id="beaten"]/span[%d]/a' % (counter)))
        if mainverifs_is_empty:
            verifications_main = find_all(
                S('//*[@id="verified"]/b[%d]/a' % (counter)))
        if extendedverifs_is_empty:
            verifications_extended = find_all(
                S('//*[@id="verified"]/span[%d]/a' % (counter)))
        if mainlist == []:
            main_is_empty = 0
        if extendedlist == []:
            extended_is_empty = 0
        if verifications_main == []:
            mainverifs_is_empty = 0
        if verifications_extended == []:
            extendedverifs_is_empty = 0
        list0.append(mainlist)
        list0.append(extendedlist)
        list0.append(verifications_main)
        list0.append(verifications_extended)
    list0 = [element for element in list0 if element != []]
    for demon in list0:
        demon = str(demon)
        start = [m.start() for m in re.finditer(">", demon)][0]
        end = [m.start() for m in re.finditer("<", demon)][1]
        demon = demon[(start + 1):end]
        list1.append(demon)
    kill_browser()
    return list1
Esempio n. 13
0
 def test_circles_home_load(self):
     Popen(['./onionr.sh', 'start'])
     while b'http' not in Popen(['./onionr.sh', 'url'],
                                stdout=subprocess.PIPE).communicate()[0]:
         sleep(1)
     url = 'http' + escapeansi.escape_ANSI(
         Popen(['./onionr.sh', 'url'], stdout=subprocess.PIPE).communicate(
         )[0].decode().split('http')[1])
     web_driver = start_firefox(url=url, headless=BROWSER_HEADLESS)
     if not Text('Circles').exists():
         click('Get Started')
     sleep(2)
     click('Circles')
     sleep(5)
     if not Text('Circle Name').exists():
         Popen(['./onionr.sh', 'stop']).wait()
         web_driver.quit()
         raise ValueError
     Popen(['./onionr.sh', 'stop']).wait()
     web_driver.quit()
Esempio n. 14
0
def ref():
    if Text("Ricarica").exists():
        while Text("Ricarica").exists():
            click("Ricarica")
            print(colorama.Fore.RED + colorama.Style.BRIGHT +
                  "The Meet is not ready")
            print(colorama.Fore.YELLOW + colorama.Style.BRIGHT +
                  "Refreshing the page...")
            timeout12 = threading.Event()
            timeout12.wait(timeout=10)
        joinf()
    while not Text("Partecipa"):
        print(colorama.Fore.RED + colorama.Style.BRIGHT +
              "The Meet is not ready")
        print(colorama.Fore.YELLOW + colorama.Style.BRIGHT +
              "Refreshing the page...")
        pyautogui.press("f5")
        timeout = threading.Event()
        timeout.wait(timeout=10)
    joinf()
Esempio n. 15
0
import helium
import hashlib

driver = helium.start_chrome("https://temp-mail.org/en/", headless=True)
helium.wait_until(
    lambda: "@" in helium.TextField("Your Temporary email address").value)
email = helium.TextField("Your Temporary email address").value
password = hashlib.sha1(email.encode()).hexdigest()
print(email, password)
helium.kill_browser()
driver = helium.start_chrome("https://www.kartable.fr/inscription")
helium.click("élève")
helium.click("1ère")
helium.click("s'inscrire avec un e-mail")
helium.write("Cld", into="prénom")
helium.write("Lokidod", into="nom")
helium.write(email, into="adresse e-mail")
helium.write(password, into="mot de passe")
helium.click("terminer")
helium.wait_until(helium.Text("plus tard").exists)
helium.click("plus tard")
#helium.kill_browser()
Esempio n. 16
0
 def delete_account(self):
     #!!!!!NOT TESTED YET!!!!!!
     # https://www.kartable.fr/compte/informations-personnelles
     helium.click("SUPPRIMER LE COMPTE")
     helium.click("SUPPRIMER DÉFINITIVEMENT")
Esempio n. 17
0
 def change_email(self, new_email):
     #!!!!!NOT TESTED YET!!!!!!
     # https://www.kartable.fr/compte/informations-personnelles/modifier-adresse-email
     for i in self.driver.find_element_by_tag_name("input"):
         helium.write(new_email, into=i)
     helium.click("mettre à jour")
Esempio n. 18
0
	def test_wait_until_presence_of_element_located(self):
		click("Click me!")
		start_time = time()
		wait_until(presence_of_element_located((By.ID, "result")))
		end_time = time()
		self.assertGreaterEqual(end_time - start_time, 0.8)
Esempio n. 19
0
 def log_in(self):
     self.driver.get("https://www.kartable.fr/connexion")
     helium.write(self.email, into="adresse e-mail")
     helium.write(self.password, into="mot de passe")
     helium.click("se connecter")
Esempio n. 20
0
 def test_click_top_left_offset(self):
     click(Button("Button 3").top_left + (3, 4))
     self.assert_result_is("Button 3 clicked at offset (3, 4).")
 def test_untick_check_box(self):
     ticked_check_box = CheckBox("Ticked CheckBox")
     click(ticked_check_box)
     self.assertIs(False, ticked_check_box.is_checked())
Esempio n. 22
0
 def setUpClass(cls):
     super().setUpClass()
     go_to(get_data_file_url('test_window/test_window.html'))
     click("Click here to open a popup.")
     wait_until(Window('test_window - popup').exists)
from contextlib import contextmanager

from helium import (
    Text,
    click,
    go_to,
    kill_browser,
    start_firefox,
    wait_until,
    write,
)


@contextmanager
def using_firefox():
    start_firefox()
    try:
        yield
    finally:
        kill_browser()


if __name__ == "__main__":
    with using_firefox():
        go_to("connpass.com/login")
        write(os.getenv("CONNPASS_USERNAME"), into="ユーザー名")
        write(os.getenv("CONNPASS_PASSWORD"), into="パスワード")
        click("ログインする")

        wait_until(Text("あなたのイベント").exists)
Esempio n. 24
0
 def test_click_text_no_implicit_wait(self):
     with TemporaryAttrValue(Config, 'implicit_wait_secs', 0):
         with self.assertRaises(LookupError):
             click("Non-existent")
Esempio n. 25
0
 def test_click_text_too_small_implicit_wait_secs(self):
     with TemporaryAttrValue(Config, 'implicit_wait_secs', 1):
         click("Click me!")
         with self.assertRaises(LookupError):
             click("Now click me!")
Esempio n. 26
0
	def test_wait_until_text_exists(self):
		click("Click me!")
		start_time = time()
		wait_until(Text("Success!").exists)
		end_time = time()
		self.assertGreaterEqual(end_time - start_time, 0.8)
 def test_select_second_radio_button(self):
     click(RadioButton("RadioButton 2"))
     self.assertIs(False, RadioButton("RadioButton 1").is_selected())
     self.assertIs(True, RadioButton("RadioButton 2").is_selected())
Esempio n. 28
0
 def register(self, sponso=False):
     if sponso == False:
         try:
             helium.click("élève")
             helium.click("élève")
         except LookupError:
             print("élève failed")
     helium.click(self.classe)
     helium.click("s'inscrire avec un e-mail")
     helium.write(self.firstname, into="prénom")
     helium.write(self.lastname, into="nom")
     helium.write(self.email, into="adresse e-mail")
     helium.write(self.password, into="mot de passe")
     # Setting custom birthdate
     self.set_birthdate()
     helium.click("terminer")
     # time.sleep(5)
     try:
         helium.click("plus tard")
     except LookupError:
         pass
     time.sleep(5)
Esempio n. 29
0
 def test_rightclick_select_normal_item(self):
     rightclick("Rightclick here for context menu.")
     click("Normal item")
     self.assertEqual("Normal item selected.",
                      self.read_result_from_browser())
Esempio n. 30
0
 def log_out(self):
     #!!!!!NOT TESTED YET!!!!!!
     self.driver.get("https://www.kartable.fr/compte")
     helium.click("Se déconnecter")
     helium.click("SE DÉCONNECTER")