我正在尝试使用Protractor / Selenium自动执行拖放操作,以检查基于图块(传单库)的地图是否正常工作,但我无法自动执行拖放操作(平移地图).
我已经加载了一个包含地图的页面,如下所示:
http://tombatossals.github.io/angular-leaflet-directive/examples/center-example.html
并且这个量角器测试不会平移地图,对所选图像的dragAndDrop操作似乎不起作用.
describe('Panning map',function() { var ptor,driver; beforeEach(function() { ptor = protractor.getInstance(); browser.get('center-example.html'); driver = ptor.driver; },30000); it('should update the center value if the map is dragged',function() { var el = element(by.xpath('.//img[contains(@class,"leaflet-tile-loaded")][1]')); browser.actions().dragAndDrop(el.find(),{ x: 40,y: 40 }).perform(); ptor.sleep(2000); expect(element(by.model("london.lat")).getAttribute("value")).toBe('51.505'); expect(element(by.model("london.lng")).getAttribute("value")).toBe('-1.09'); }); });
这可能是dragAndDrop操作不适用于这样的例子的原因?
这是一个已知的webdriver问题:
https://code.google.com/p/selenium/issues/detail?id=3604