Java 在标签之间切换时遇到障碍

Java 在标签之间切换时遇到障碍,java,eclipse,selenium-webdriver,cucumber,Java,Eclipse,Selenium Webdriver,Cucumber,我无法在选项卡之间切换,如下图所示。我正在使用cucumber框架 我得到的例外情况是: org.openqa.selenium.WebDriverException: unknown error: Element <button class="btn btn-emp alignrightfromright" data-target="#myModal" data-toggle="modal">...</button> is not clickable at poin

我无法在选项卡之间切换,如下图所示。我正在使用cucumber框架

我得到的例外情况是:

org.openqa.selenium.WebDriverException: unknown error: 
Element <button class="btn btn-emp alignrightfromright" data-target="#myModal" data-toggle="modal">...</button> is not clickable at point (1275, 85)
步骤定义类(Professional\u infoSD.java)


可能有两个原因:

  • 该元素不可见,在这种情况下,您可以使用javascript代码在视图中滚动该元素(向上/向下),然后执行该操作

    JavascriptExecutor js=(JavascriptExecutor)驱动程序
    
    js.executeScript(“滚动(200200)”;//示例

  • 您要单击的元素上覆盖着另一个元素(表单/div)。请检查您是否标识了正确的元素。您的定位器可能指向员工表单下方页面上的元素


  • 希望这有帮助。

    对于SO中的“元素在某一点上不可单击”有多个答案。请在此处选择您喜欢的任何人-
    public void ClickProfTab() {
            log.info("Clicking on professional info tab....");
            Actions action = new Actions(driver);
              action.moveToElement(profTab).build().perform();
              profTab.click();
        }
    
    @When("^click on the Professional information Form tab$")
        public void click_on_the_Professional_information_Form_tab() throws Throwable {
            professionalinfo= new Professional_InfoPage();
            professionalinfo.ClickProfTab();        
        }