def search_and_enter_631(self, point): """消息页全局搜索内容并进入""" self.click_search() from pages import SearchPage SearchPage().input_search_keyword(point) self.click_element( (MobileBy.XPATH, '//*[@resource-id="com.chinasofti.rcs:id/tv_name" and @text ="%s"]' % point))
def search_and_enter2(self, point): """消息页全局搜索内容并进入""" locator = (MobileBy.XPATH, '//*[@resource-id="com.chinasofti.rcs:id/tv_name" and @text ="%s"]' % point) from pages import SearchPage sp = SearchPage() self.click_search() sp.input_search_keyword(point) time.sleep(1) sp.click_element_c('团队联系人文本') time.sleep(2) self.find_element_by_swipe(locator) self.click_element(locator)
from pages import HomePage from pages import SearchPage from selenium import webdriver from webdriver_manager.chrome import ChromeDriverManager driver = webdriver.Chrome(ChromeDriverManager().install()) driver.get("https://en.wikipedia.org/wiki/Main_Page") driver.maximize_window() home_page = HomePage(driver) home_page.set_search_query("Design pattern") home_page.search() result = SearchPage(driver) print(result.heading_text() == "Design pattern") driver.quit()
from time import sleep from selenium import webdriver from pages import SearchPage from pages import ResultPage driver = webdriver.Chrome('./chromedriver') search_page = SearchPage(driver) search_page.open() search_page.search('ブラウザ自動化ツール') result_page = ResultPage(search_page.driver) print(result_page.get_result_stats()) sleep(1) result_page.close()
# -*- coding: utf-8 -*- from time import sleep from selenium import webdriver from selenium.webdriver.common.keys import Keys import chromedriver_binary from pages import SearchPage from pages import ResultPage driver = webdriver.Chrome() search_page = SearchPage(driver) search_page.open() search_page.search_box.search('Automation tool') result_page = ResultPage(search_page.driver) print(result_page.get_result_stats()) sleep(1) result_page.close()