예제 #1
0
def naver_login(browser):
    browser.find_element_by_xpath("""//*[@id="account"]/a""").click()
    randomized_sleep()

    copy_input(browser, '//*[@id="id"]', naver_login['id'])
    copy_input(browser, '//*[@id="pw"]', naver_login['pw'])

    browser.find_element_by_xpath("""//*[@id="log.login"]""").click()
    randomized_sleep(2)
예제 #2
0
 def scroll_up(self, offset=-1, wait=2):
     if offset == -1:
         self.driver.execute_script("window.scrollTo(0, 0)")
     else:
         self.driver.execute_script("window.scrollTo(0, -%s" % offset)
     randomized_sleep(wait)
예제 #3
0
 def page_down(self, wait=0.3):
     self.driver.execute_script("window.scrollTo(0, 1080")
     randomized_sleep(wait)
예제 #4
0
 def scroll_down(self, wait=0.3):
     self.driver.execute_script(
         "window.scrollTo(0, document.body.scrollHeight")
     randomized_sleep(wait)
예제 #5
0
def iframe_to_driver(browser, url):
    browser.get(url)
    browser.driver.switch_to.frame("cafe_main")
    randomized_sleep()
예제 #6
0
def click_and_input(browser, xpath, input):
    browser.find_element_by_xpath(xpath).click()
    browser.find_element_by_xpath(xpath).send_keys(input)
    randomized_sleep()
예제 #7
0
def copy_input(browser, xpath, input):
    browser.find_element_by_xpath(xpath).click()
    pyperclip.copy(input)
    browser.find_element_by_xpath(xpath).send_keys(Keys.CONTROL, 'v')
    randomized_sleep()
예제 #8
0
 def scroll_up(self, offset=-1, wait=2):
     if offset == -1:
         self.driver.execute_script('window.scrollTo(0, 0')
     else:
         self.driver.execute_script(f'window.scrollBy(0, {offset})')
     randomized_sleep(wait)