Ejemplo n.º 1
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()
Ejemplo n.º 2
0
	def highlight_impl(self, element):
		driver = self.require_driver()
		from helium import HTMLElement, Text
		if isinstance(element, str):
			element = Text(element)
		if isinstance(element, HTMLElement):
			element = element._impl
		try:
			element = element.first_occurrence
		except AttributeError:
			pass
		previous_style = element.get_attribute("style")
		if isinstance(element, WebElementWrapper):
			element = element.unwrap()
		driver.execute_script(
			"arguments[0].setAttribute("
				"'style', 'border: 2px solid red; font-weight: bold;'"
			");", element
		)
		driver.execute_script(
			"var target = arguments[0];"
			"var previousStyle = arguments[1];"
			"setTimeout("
				"function() {"
					"target.setAttribute('style', previousStyle);"
				"}, 2000"
			");", element, previous_style
		)
Ejemplo n.º 3
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)
Ejemplo n.º 4
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()
Ejemplo n.º 5
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()
Ejemplo n.º 6
0
def wait(string=None):

    if (string in BUTTON):

        if (string in BUTTON[:6] or string == 'Add an Item'):

            sleep(1)

            WebDriverWait(driver,999).until(EC.presence_of_element_located(
                (By.XPATH, "//body[@class='o_web_client']")))

        wait_until(Button(string).exists,999)

    else:
        wait_until(Text(string).exists,999)
 def test_free_text_not_surrounded_by_tags_exists(self):
     self.assertTrue(Text("Free text not surrounded by tags").exists())
 def test_read_text_value(self):
     self.assertEqual(Text(to_right_of=Text("EUR/USD")).value, "1.3487")
 def test_text_with_leading_nbsp_exists(self):
     self.assertTrue(Text("Text with leading  ").exists())
 def test_text_exists_link_with_title_lower_case(self):
     self.assertTrue(Text("link with title").exists())
 def test_text_exists_link_with_title(self):
     self.assertTrue(Text("Link with title").exists())
 def test_text_exists_submit_button_lower_case(self):
     self.assertTrue(Text("submit button").exists())
 def test_text_exists_submit_button(self):
     self.assertTrue(Text("Submit Button").exists())
 def test_text_with_apostrophe(self):
     self.assertTrue(Text("Your email's been sent!").exists())
 def test_text_with_single_and_double_quotes(self):
     self.assertTrue(Text("Single'quote. Double\"quote.").exists())
Ejemplo n.º 16
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)
Ejemplo n.º 17
0
 def test_test_text_in_iframe_exists(self):
     self.assertTrue(Text("This text is inside an iframe.").exists())
Ejemplo n.º 18
0
 def test_access_attributes_across_iframes(self):
     text = Text("This text is inside an iframe.")
     self.assertEqual("This text is inside an iframe.", text.value)
     get_driver().switch_to.default_content()
     self.assertEqual("This text is inside an iframe.", text.value)
Ejemplo n.º 19
0
def closef():
    if Text("Chiudi").exists():
        click("Chiudi")
Ejemplo n.º 20
0
 def test_switches_to_popup(self):
     self.assertTrue(Text("In popup.").exists())
 def test_text_with_double_quotes(self):
     self.assertTrue(Text('He said "double quotes".').exists())
Ejemplo n.º 22
0
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)
 def test_text_uppercase_umlaut(self):
     self.assertTrue(Text('VERÖFFENTLICHEN').exists())
Ejemplo n.º 24
0
	def test_highlight_string(self):
		highlight("Text with id")
		self._check_is_highlighted(Text("Text with id"))