相关疑难解决方法(0)

"元素目前不可见,因此可能无法与之交互"但另一个是?

我创建了另一个问题,我认为是导致此错误的原因:为什么Selenium Firefox驱动程序会在父进程溢出时认为我的模态没有显示:隐藏?

Selenium版本2.33.0
Firefox驱动程序

导致错误的代码:

        System.Threading.Thread.Sleep(5000);
        var dimentions = driver.Manage().Window.Size;
        var field = driver.FindElement(By.Id("addEmployees-password")); //displayed is true
        field.Click(); //works fine
        var element = driver.FindElement(By.Id(buttonName)); //displayed is false
        element.Click(); //errors out
Run Code Online (Sandbox Code Playgroud)

它试图点击的按钮:

<div id="addEmployees" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="addEmployeesLabel" aria-hidden="true">

    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h3>Add Employee</h3>
    </div>

    <div class="modal-body">
        <p class="alert alert-info">
            <input name="addEmployees-username" id="addEmployees-username" />
            <input name="addEmployees-password" id="addEmployees-password" type="password" />
            <input name="addEmployees-employee" id="addEmployees-employee" />
        </p>
    </div>

    <div class="modal-footer">
        <button name="addEmployees-add" id="addEmployees-add" type="button" class="btn" data-ng-click="submit()">Add</button>
    </div> …
Run Code Online (Sandbox Code Playgroud)

c# angularjs selenium-webdriver angular-strap

8
推荐指数
2
解决办法
3万
查看次数

标签 统计

angular-strap ×1

angularjs ×1

c# ×1

selenium-webdriver ×1