我必须单击地图,然后从那里选择一个位置。它在画布标签内。我该如何使用硒呢?
HTML代码-
<canvas class="leaflet-zoom-animated" width="3740" height="1408" style="transform: translate3d(-153px, -59px, 0px); width: 1870px; height: 704px;"></canvas>
硒无法单击。
答案 0 :(得分:0)
IWebElement canvas = driver.FindElement(By.Id("TimeZoneId"));
int xCo = canvas.Location.X;
int yCo = canvas.Location.Y;Actions action = new Actions(driver);
action.MoveToElement(canvas, 'your x coordinates' + xCo, 'your y coordinates' + yCo).Click().Build().Perform();