在UIAutomator Viewer中可以看到标记除索引外没有任何其他内容。
我试图通过以下方式模拟特定标记的点击:
UiObject gMap = mDevice.findObject(new UiSelector().descriptionContains("Google Map"));
UiObject marker = mDevice.findObject(gMap.getSelector().index(1));
marker.clickAndWaitForNewWindow();
但点击没有发生。如何模拟单击标记?
答案 0 :(得分:0)
使用CulebraTester和示例地图应用程序(如图所示)
有3个标记:2个红色有标题和摘要,蓝色没有,你可以看到生成的代码有什么不同。
mDevice.findObject(By.desc("title_of_marker1. snippet_of_marker1.").clazz("android.view.View").text(Pattern.compile("")).pkg("com.example.diego.mymapapplication")).clickAndWait(Until.newWindow(), DEFAULT_TIMEOUT);
mDevice.findObject(By.desc("title_of_marker2. snippet_of_marker2.").clazz("android.view.View").text(Pattern.compile("")).pkg("com.example.diego.mymapapplication")).clickAndWait(Until.newWindow(), DEFAULT_TIMEOUT);
mDevice.findObject(By.desc("Google Map").clazz("android.view.View").text(Pattern.compile("")).pkg("com.example.diego.mymapapplication")).clickAndWait(Until.newWindow(), DEFAULT_TIMEOUT);
第三选择器太宽泛而且含糊不清。
我想如果你添加标题和/或片段,点击它们就没问题了。
答案 1 :(得分:0)
不要使用<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/production/application
Alias production
<Directory "/var/www/html/production/application">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require all granted
Order allow,deny
allow from all
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
。您应该使用gMap.getSelector()
来搜索地图视图中的标记
childSelector
在点击之前尝试使用UiObject marker = mDevice.findObject(UiSelector()
.descriptionContains("Google Map")
.childSelector(UiSelector().instance(1))
)
。通常它们不会立即显示在地图上