[英]How to tap on google map marker in swift UITest
我想在 ios 的谷歌地圖中點擊谷歌標記。
我有一張谷歌地圖和地圖上的標記,我想點擊它。 標記有圖標和一個帶數字的標簽。
類似上面的東西。我還提交了在地圖上添加標記的代碼。
let pinView = UIView(frame: CGRect(x: 0, y: 0, width: 40, height: 40))
let circleArrow = UIImageView(frame: CGRect(x: 0, y: 0, width: 40, height: 40))
circleArrow.image = UIImage(named: "circleArrow")
pinView.addSubview(circleArrow)
let ridersLabel = UILabel(frame: CGRect(x: 0, y: 15, width: 40, height: 20))
ridersLabel.text = "\(riders)"
ridersLabel.textAlignment = .center
ridersLabel.textColor = UIColor.white
ridersLabel.transform = CGAffineTransform(rotationAngle: CGFloat(.pi * self.getLabelRotation(heading: heading) / 180.0))
pinView.addSubview(ridersLabel)
pickupMarker.icon = self.imageFromView(aView: pinView)
pickupMarker.rotation = heading
pickupMarker.groundAnchor = CGPoint(x: 0.5, y: 0.5)
pickupMarker.infoWindowAnchor = CGPoint(x: 0.5, y: 1.0)
pickupMarker.map = self.vwMapView
目前我正在嘗試獲得如下代碼 UITestCode 的標記。
if (self.app.staticTexts["\(n)"].exists)
{
let markerAvailable = self.app.staticTexts["2"]
markerAvailable.tap()
}
上面的代碼不起作用。
至少在可訪問性檢查器中顯示引腳的解決方案
let mapView = GMSMapView(frame: .zero)
mapView.accessibilityElementsHidden = false
let marker = GMSMarker(position: ...)
marker.accessibilityElementsHidden = false
marker.userData = someString // I used earlgrey to find it by userData, most probably it's possible to find it with default API somehow too
我可以搜索這些圖釘,但我不知道如何點按它們
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.