def page_scroll(self):
     _element = self.find(By.CSS_SELECTOR, ".container .type7")
     _actions = TouchActions(self._driver)
     _actions.scroll_from_element(_element, 0,
                                  3000).scroll(0, -3000).perform()
     _text = self.find(By.CSS_SELECTOR, ".l .on").text
     return _text
예제 #2
0
 def test_touch_action(self):
     self.driver.get("https://baidu.com/")
     self.driver.find_element(By.ID, "kw").send_keys("霍格沃兹测试学校")
     action = TouchActions(self.driver)
     action.tap(self.driver.find_element(By.ID, "su")).perform()
     action.scroll_from_element(self.driver.find_element(By.ID, "su"), 0,
                                10000).perform()
예제 #3
0
 def test_touchaction_scrollbottom(self):
     self.driver.get("https://www.baidu.com/")
     el = self.driver.find_element(By.ID, "kw")
     el.send_keys("selenium测试")
     el1 = self.driver.find_element(By.ID, "su")
     action = TouchActions(self.driver)
     action.tap(el1)
     action.scroll_from_element(el, 0, 10000).perform()
예제 #4
0
 def touchaction_scrollbottom(self, ele):
     '''
     使用 TouchActions 实现界面滑动到底部
     :param ele:
     '''
     action = TouchActions(self.driver)
     action.scroll_from_element(ele, 0, 10000)
     action.perform()
예제 #5
0
 def test_touch(self):
     self.driver.get("https://www.baidu.com/")
     self.driver.find_element(By.XPATH,
                              "//*[@id='kw']").send_keys("selenium_3")
     ele = self.driver.find_element(By.XPATH, "//*[@id='su']")
     action = TouchActions(self.driver)
     action.tap(ele)
     action.perform()
     action.scroll_from_element(ele, 0, 10000).perform()
     sleep(3)
예제 #6
0
 def test_TouchAction(self):
     self.driver.get('http://www.baidu.com')
     element_input = self.driver.find_element_by_id("kw")
     element_search = self.driver.find_element_by_id("su")
     action = TouchActions(self.driver)
     element_input.send_keys("selenium测试")
     action.tap(element_search)
     action.perform()
     #将页面向下滚动,需要三个参数,
     action.scroll_from_element(element_input, 0, 10000).perform()
예제 #7
0
 def scroll(self, to_y=2000):
     """
     滑动页面
     :return:
     """
     elem = self.get_element()
     action = TouchActions(self.driver)
     action.scroll_from_element(elem, 0, to_y)
     action.perform()
     sleep(2)
예제 #8
0
    def test_touchAction_scollbottom(self):
        self.driver.get("https://www.baidu.com/")
        clc=self.driver.find_element_by_id("kw")
        clc.send_keys("selenium测试")
        clc2=self.driver.find_element_by_id("su")
        action= TouchActions(self.driver)
        action.tap(clc2).perform()

        action.scroll_from_element(clc2,0,10000).perform()
        time.sleep(5)
예제 #9
0
 def test_scroll_bottom(self):
     self.driver.get("http://www.baidu.com")
     ele_input = self.driver.find_element_by_id('kw')
     ele_input.send_keys('selenium测试')  # 输入框中输入内容
     ele_search = self.driver.find_element_by_id('su')
     action = TouchActions(self.driver)
     action.tap(ele_search).perform()  # 点击百度一下进行搜索
     action.scroll_from_element(ele_input, 0, 10000).perform()  # 完成页面滑动
     sleep(2)
     self.driver.find_element_by_link_text("下一页 >").click()  # 滑动到最下面点击下一页
     sleep(1)
예제 #10
0
 def test_touchaction(self):
     self.driver.get("http://www.baidu.com")
     ele = self.driver.find_element(By.ID, "kw")
     ele.send_keys("ruby study")
     search_btn = self.driver.find_element(By.ID, "su")
     action = TouchActions(self.driver)
     action.tap(search_btn)
     sleep(5)
     action.scroll_from_element(ele, 0, 10000)
     action.perform()
     sleep(5)
예제 #11
0
파일: action.py 프로젝트: jine2020/test_stu
    def test_action(self):
        self.driver.get('http://www.baidu.com')
        el = self.driver.find_element(By.ID, 'kw')
        el_search = self.driver.find_element(By.ID, 'su')

        el.send_keys('selenium测试')
        action = TouchActions(self.driver)
        action.tap(el_search)
        action.perform()

        action.scroll_from_element(el, 0, 10000).perform()