Angular 如何使用量角器单击传单地图的中心

Angular 如何使用量角器单击传单地图的中心,angular,typescript,selenium,protractor,leaflet,Angular,Typescript,Selenium,Protractor,Leaflet,我试图单击页面第二列地图的中心(因此它有一个偏移量),但不起作用,似乎光标总是指向页面中心: 我正在尝试添加宽度/高度一半的位置,以下是代码: it('should select center point',async()=>{ 常量map=pageObject.getMap();//$(“.map容器”) const size=wait map.getSize(); const location=wait map.getLocation(); const halfWidth=parseInt

我试图单击页面第二列地图的中心(因此它有一个偏移量),但不起作用,似乎光标总是指向页面中心:

我正在尝试添加宽度/高度一半的位置,以下是代码:

it('should select center point',async()=>{
常量map=pageObject.getMap();//$(“.map容器”)
const size=wait map.getSize();
const location=wait map.getLocation();
const halfWidth=parseInt(wait map.getAttribute('clientWidth'),10)/2;
const halfHeight=parseInt(wait map.getAttribute('clientHeight'),10)/2;
常数x=位置x+半宽度;
常数y=位置y+半高;
等待浏览器
1.行动()
.mouseMove(映射,{x,y})
。单击()
.perform();
log('size',size){高度:482,宽度:840}
log('location',location){x:523,y:145}
console.log('halfWidth',halfWidth);//420
console.log('halfHeight',halfHeight);//241
console.log('x',x);//943
console.log('y',y);//386
调试器;
});
窗口大小是
1380*668
所以
943
386
似乎是正确的,我不知道为什么它不工作

我也尝试不处理偏移量,但它不起作用:

等待浏览器
1.行动()
.mouseMove(映射,{x:halfWidth,y:halfHeight})
。单击()
.perform();

我尝试使用
map.getWebElement()
,来更改选择器,但没有任何效果

因此我找到了一个解决方案,默认情况下,当我单击地图元素时,量角器单击中心:

wait pageObject.getMap().click();
要单击一个特定的地址,我直接在地理编码器栏上键入一个地址,然后单击地图以获取中心,但我没有找到使用
moveMove(元素,{x,y})