当前位置: 首页 > news >正文

如何给自己做网站全国疫情今天最新消息

如何给自己做网站,全国疫情今天最新消息,图片在线编辑网站,追星做网站0.使用inspector时,一定要把不相关的如weditor啥的退出去,否则,净是事。 1.从0开始的数据获取 第一个位置,有时0.0.0.0,不可以的话,你就用这个。 第二个位置,抄上。 直接点击第三个启动。不要…

0.使用inspector时,一定要把不相关的如weditor啥的退出去,否则,净是事。

1.从0开始的数据获取

 第一个位置,有时0.0.0.0,不可以的话,你就用这个。

第二个位置,抄上。

直接点击第三个启动。不要问为什么,问就是。我也不知道。

第一个错误:它说得有个平台名,好吧。

错误
Failed to create session. An unknown server-side error occurred while processing the command. Original error: You must include a platformName capability

添上

注意一定要添上如下

"appium:automationName": "UiAutomator2"

再次启动。OK了进来了。

 再次提醒,版本不一样,出错不一样,你根据出错的地方完善就可以。

2.获取某团相关

 自动点击手机上的某团,打开它。

 一个一个的点复制。

'getCurrentActivity' "com.meituan.android.pt.homepage.activity.MainActivity"
'getCurrentPackage' "com.sankuai.meituan"

 返回修改

{"appium:platformName": "Android","appium:automationName": "UiAutomator2","appium:appPackage": "com.sankuai.meituan","appium:appActivity": "com.meituan.android.pt.homepage.activity.MainActivity"
}

 其他信息模仿吧。

通过adb获取信息

C:\Users\Administrator>adb shell dumpsys activity | findstr "mResume"mResumedActivity: ActivityRecord{1fef505 u0 com.sankuai.meituan/com.meituan.android.pt.homepage.activity.MainActivity t1097}

 形成测试代码:


from appium import webdriver
from appium.options.android import UiAutomator2Options
desired_caps = {"platformName": "Android","platformVersion": "10","deviceName": "Q5X7N19605002672","appium:appPackage": "com.sankuai.meituan","appium:appActivity": "com.meituan.android.pt.homepage.activity.MainActivity","unicodeKeyboard": True,"resetKeyboard":True,"noReset":True,"appium:newCommandTimeout": 6000,"appium:automationName": "UiAutomator2"
}if desired_caps is not None:driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', options=UiAutomator2Options().load_capabilities(desired_caps))
else:raise ValueError("desired_caps must not be None")

 运行成功。

用inspector进行附加。

利用代码启动某团,一定要利用pycharm中的代码进行,否则无效,原理很简单。就是通过appium互动留下的信息进行启动的。

再次刷新附加

界面示例:

3.点击某个元素、输入文本、搜索等。

点击超市便利为例:

 

 有一个结果,点击一下。看手机是否正常反映

有反映,记录之

(//android.widget.ImageView[@resource-id="com.sankuai.meituan:id/channel_icon"])[5]

 输入商店名称进行搜索:以下记得刷新,否则你明白 的。信息不准。

方法同上。

输入框定位后,点击一下。

//android.widget.LinearLayout[@resource-id="com.sankuai.meituan:id/minutes_animte_action_search"]/android.widget.LinearLayout[1]

进入新窗口

通过应用源一级级定位到最低级的编辑框位置。输入想要搜索的关键词。

//android.widget.EditText[@resource-id="com.sankuai.meituan:id/txt_search_keyword"]

如下图:

定位搜索按钮。

//android.widget.LinearLayout[@resource-id="com.sankuai.meituan:id/search_tv"]

来到以下页面。

点击排名第一个商店,进入商店 

 通过应用源一级级的定位,不再多说。

(//android.widget.FrameLayout[@resource-id="com.sankuai.meituan:id/mach_container_wrapper"])[2]

来到如图:

4.根据以上查证结果,生成py文件,进行自动操作。

提醒,以上其实是XPATH定位,不是最推荐的,但目前,用这个就行。

 以下代码,完整无伤通过。


from appium import webdriver
from appium.options.android import UiAutomator2Options
desired_caps = {"platformName": "Android","platformVersion": "10","deviceName": "Q5X7N19605002672","appium:appPackage": "com.sankuai.meituan","appium:appActivity": "com.meituan.android.pt.homepage.activity.MainActivity","unicodeKeyboard": True,"resetKeyboard":True,"noReset":True,"appium:newCommandTimeout": 6000,"appium:automationName": "UiAutomator2"
}driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', options=UiAutomator2Options().load_capabilities(desired_caps))# 设置超时时间和重试间隔
timeout = 10
poll_frequency = 1
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC####################### 点击超市便利########################################################element = WebDriverWait(driver, timeout, poll_frequency).until(EC.element_to_be_clickable((By.XPATH, '(//android.widget.ImageView[@resource-id="com.sankuai.meituan:id/channel_icon"])[5]'))
)
element.click()
######################### 点击搜索框########################################################
element = WebDriverWait(driver, timeout, poll_frequency).until(EC.element_to_be_clickable((By.XPATH, '//android.widget.LinearLayout[@resource-id="com.sankuai.meituan:id/minutes_animte_action_search"]/android.widget.LinearLayout[1]'))
)
element.click()
##################### 使用显式等待定位并输入文本############################################################
try:search_box = WebDriverWait(driver, timeout, poll_frequency).until(EC.presence_of_element_located((By.XPATH, "//android.widget.EditText[@resource-id='com.sankuai.meituan:id/txt_search_keyword']")))search_box.send_keys("优小优")
except Exception as e:print(f"无法找到或操作元素: {e}")########################## 点击搜索按钮#########################################################element = WebDriverWait(driver, timeout, poll_frequency).until(EC.element_to_be_clickable((By.XPATH, '//android.widget.LinearLayout[@resource-id="com.sankuai.meituan:id/search_tv"]'))
)
element.click()########################## 点击排名第一的商店#########################################################element = WebDriverWait(driver, timeout, poll_frequency).until(EC.element_to_be_clickable((By.XPATH, '(//android.widget.FrameLayout[@resource-id="com.sankuai.meituan:id/mach_container_wrapper"])[2]'))
)
element.click()

 

 希望你也能一次无伤通过。

下一节,打算获取其商品数据。并保存之。 

http://www.mmbaike.com/news/39988.html

相关文章:

  • web网站开发案例的好书正规优化公司哪家好
  • wordpress性能甘肃seo网站
  • 做网站需要哪个专业买链接网
  • 网站的引导页怎么做的精品成品网站入口
  • 自己做网站要多少钱网站优化建设
  • 做网站版头蓝色图片推广关键词优化
  • 哪个网站有上门做指甲推广营销软件app
  • 网站制作例子seo培训中心
  • 龙岩建设局网站罗小波线上营销活动方案
  • 制作微信公众号的网站开发武汉seo公司出 名
  • 网站建设和维护价格网站制作河南
  • 域名过期做的网站怎么办360竞价推广技巧
  • 如何仿做网站百度seo软件优化
  • 网站图片切换代码深圳华强北
  • seo网站计划书抖音关键词优化排名靠前
  • ui设计周末培训机构网站推广和精准seo
  • 杭州动漫设计公司最新招聘百度关键词优化企业
  • 黑河北京网站建设数据分析师培训机构推荐
  • 仿58网站怎么做凡科网小程序
  • 做阿里巴巴类似的网站吗seo和sem的区别是什么
  • 深圳网站建设网站制作公司seo推广人员
  • 典型网站建设百度文章收录查询
  • 车票网站模板百度排行
  • 视频上传网站建设外贸b2b平台都有哪些网站
  • 做网站图片太多怎么办营销推广渠道有哪些
  • 全能网站建设蜘蛛seo超级外链工具
  • 石家庄个人谁做网站外贸海外推广
  • 外贸网站优势百度贴吧人工客服电话
  • 网站服务类型怎么选社交网络推广方法
  • 飞创网站建设免费找精准客户软件