webdriver - Appium提交网址
问题描述
我正在使用 Python 和 Android Chrome。我WebDriver
是使用创建的WebDriver.Remote(host, caps)
我实际上想在隐身模式下使用 Chrome,但根据这里的问题似乎不可能。
但是有什么解决方法吗?例如,我可以将我的 url 提交到 Chrome 顶部的 url 栏吗?我试过driver.find_element_by_id('com.android.chrome:id/url_bar').submit()
了,但它说没有实现。
解决方案
这是我的解决方法。解释在评论中。
# Open Menu/More Button
d.find_element_by_id('com.android.chrome:id/menu_button').click()
# Click On Incognito Mode
d.find_element_by_xpath('/hierarchy/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.ListView/android.widget.LinearLayout[3]').click()
# Find Url Bar on the top
url_bar = d.find_element_by_id('com.android.chrome:id/url_bar')
# Click on it which gives you another view.
url_bar.click()
# Set url and this gives you a list of options
url_bar.set_text('https://a.lianwifi.com/app_h5/jisu/wifiapk/sms.html?c=uvtest&type=1')
# Click the first one. This is the one that leads you to the page with your url.
d.find_element_by_xpath('/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout[2]/android.widget.ListView/android.view.ViewGroup[1]/android.view.ViewGroup').click()
推荐阅读
- javascript - 具有动态生成内容的闭包
- configuration - 强制 ORIENTDB_HOME 和 ORIENTDB_DIR
- ocaml - 如何在ocaml中将二进制代码与源代码分开?
- c# - C#如何识别两个对象之间的碰撞
- css - 用本地 css 替换全局 css
- ssl - 从 IBM JRE 1.6 连接到 SOAP 服务时出现问题
- java - 整数无法转换为 JSONObject
- java - 水平滚动条不适用于 JScrollPane
- azure-cognitive-search - 在天蓝色搜索中按多个字段分组/分面
- python - 用于检查特定键是否存在于列表和字典的字典中的 Python 代码