当前位置: 首页 > 知识库问答 >
问题:

元素在需要滚动的点(194,-212)处不可单击

欧阳狐若
2023-03-14

我在跑咕噜-量角器-转轮。

量角器:2.0.0Jasmine:1.3 Linux Ubuntu 14.4

it("It should click next page botton" + pageIndex, function() {
    pageIndex++;
    //var nextPageSelector = element(by.id("pageNavigator_" + pageIndex));
    var nextPageSelector = element(by.xpath('//li[@class="next"]/a'));
    browser.debugger();
    //expect(browser.isElementPresent(nextPageSelector)).toBeTruthy();
    console.log("Page title: " + pageTitles.length + "Page index" + pageIndex);

    if (pageIndex <= pageTitles.length) {
        console.log("About to click next button");
        //console.log("Co-ordinates: "+ nextPageSelector2.getCoordinates());
        nextPageSelector.getLocation().then(function(buttonLocation) {
            console.log("X coordinate: " + buttonLocation.x + " Y Coordinate: " + buttonLocation.y);
            var sc = '"scroll(' + buttonLocation.x + ', ' + buttonLocation.y + ')"';
            console.log("Statement: " + sc);
            browser.actions().mouseMove(buttonLocation.x , buttonLocation.y);//.click().perform();
            //browser.executeScript(sc); //
            browser.wait(2000);
            nextPageSelector.click().then(function() {
                console.log("Successfully clicked");
                browser.waitForAngular();
            }, function() {
                console.log("Unable to click");
            });
        });

    }
});

共有1个答案

沈建柏
2023-03-14

这招对我管用:

var filterWidget = browser.findElement(by.id(widgetsId)); 
var scrollIntoView= function() { arguments[0].scrollIntoView(); }; 
browser.executeScript(scrollIntoView, filterWidget);
 类似资料:
  • 我有一个模式上传图像,当我点击上传图像,它是导航到本地计算机,然后选择指定的图像。在导航到本地计算机后,我发现了一个错误。 2个规格,1个故障。 和我上载映像的代码:

  • 脚本: 登录www.flipkart。com,并在成功登录后从“电子产品”中选择“三星”。现在,我需要滚动到页面底部,从左侧,我需要点击可用性来选择“排除股票期权”,但点击可用性,我会收到消息 失败:Test_Samsung org。openqa。硒。WebDriverException:元素在点(119,9)处不可单击。其他元素将收到点击:

  • 使用WebDriver在Chrome上执行操作 我有一个扩展名为.xqy的网页。在这里我执行一些操作并打开第一个帧。然后,在第一帧上做了一些动作之后,我打开第二帧,然后是第三帧。现在,我需要在第一帧上执行一些操作,因此我关闭Selenium当前焦点所在的第三帧,然后使用以下代码关闭第二帧: 对决议有什么想法吗?也尝试过使用Actions类,但没有用。

  • 我有一个web应用程序,我正试图为其编写selenium测试,但我遇到了Chrome驱动程序的问题。有一个向导类型的界面,用户可以使用它来填写表单。有一个按钮可以添加一个带有几个设置的行。我已经用黑色概述了这一点。蓝色矩形显示按钮的可点击区域。这个矩形的中间没有重叠其他任何东西。 问题是有一个巨大的div包含整个屏幕和Chrome说这个div将获得点击。那么,我该怎么绕过这件事呢?这似乎不是正确的

  • 我在chromedriver上运行测试时出错,因为它在FirefoxDriver上运行良好: WebDriverException:未知错误:元素在点(1270,449)处不可单击。其他元素将接收点击:(会话信息:Chrome=44.0.2403.157)(驱动程序信息:ChromeDriver=2.17.340124 知道怎么了吗?我正在使用最新的ChromeDriver。

  • WebDriverException:元素在点(36,72)处不可单击。其他元素将收到click:...命令持续时间或超时:393毫秒 如果我使用,我不会收到任何警告。