airtest笔记
1、连selenium,参考http://airtest.netease.com/docs/cn/2_device_connection/5_windows_connection.html
后台的代码
# -*- encoding=utf8 -*-
__author__ = "wangna"
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from airtest_selenium.proxy import WebChrome
from selenium.webdriver.support.select import Select
driver = WebChrome()
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from airtest_selenium.proxy import WebChrome
driver = WebChrome()
driver.implicitly_wait(20)
from poco.drivers.android.uiautomation import AndroidUiautomationPoco
poco = AndroidUiautomationPoco(use_airtest_input=True, screenshot_each_action=False)
driver.implicitly_wait(20)
driver.get("https://ad-cc-tst.hupu.com/#/brandAd/material/myMaterial")
# driver.find_element_by_xpath("//button[@type='submit']").click()
driver.find_element_by_xpath("//input[@placeholder='虎扑域帐号']").send_keys("wangna")
driver.find_element_by_xpath("//input[@type='password']").send_keys("Qw123456")
driver.find_element_by_xpath("//button[@type='submit']").click()
#我的素材页-新增素材
driver.find_element_by_xpath("//*[@id=\"root\"]/div/div/div/div[2]/div[2]/div/div/button").click()
driver.find_element_by_id("name").send_keys("大图静态图")
driver.find_element_by_xpath("//*[@id=\"industry\"]/div/div/div[1]").click()
print("22222")
driver.find_element_by_xpath("//div[contains(@style,'display: block;')]")
print("33131")
driver.find_element_by_xpath("//*[@id=\"industry\"]/div/div/div").click()
# driver.driver.find_element_by_xpath("//a[text(),'内部使用')]").click()
# opt_1 =driver.find_element_by_xpath("//*[@id=\"industry\"]/div/div/div")
# Select(opt_1).select_by_visible_text("内部使用")
# opt_2 =driver.find_element_by_xpath("//*[@id=\"mediaId\"]/div/div/div")
# Select(opt_2).select_by_visible_text("虎扑App")
# opt_3 =driver.find_element_by_xpath("//*[@id=\"adformId\"]/div/div/div")
# Select(opt_3).select_by_visible_text('信息流大图静态图')
# driver.find_element_by_xpath("/html/body/div[2]/div/div[2]/div/div[2]/div[3]/div/button[2]").click()
由于下拉框没有定位到,就结束了