Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs SeleniumWebDriver无法在ubuntu服务器中使用Xpath/Css定位元素,但在窗口浏览器中工作正常_Angularjs_Ubuntu_Selenium_Webdriver - Fatal编程技术网

Angularjs SeleniumWebDriver无法在ubuntu服务器中使用Xpath/Css定位元素,但在窗口浏览器中工作正常

Angularjs SeleniumWebDriver无法在ubuntu服务器中使用Xpath/Css定位元素,但在窗口浏览器中工作正常,angularjs,ubuntu,selenium,webdriver,Angularjs,Ubuntu,Selenium,Webdriver,我们的应用程序前端页面是html+Angular.js脚本的混合体,我们的Selenium Webdriver脚本能够在执行时使用xpath/css在window ff浏览器中成功地定位元素,但同样的脚本在ubuntu server headless ff浏览器中失败,并显示以下错误日志 错误日志:org.openqa.selenium.NoSuchElementException:找不到元素:{“方法”:“xpath”,“选择器”:“/*[@id='main-content']/div[@ng

我们的应用程序前端页面是html+Angular.js脚本的混合体,我们的Selenium Webdriver脚本能够在执行时使用xpath/css在window ff浏览器中成功地定位元素,但同样的脚本在ubuntu server headless ff浏览器中失败,并显示以下错误日志

错误日志
org.openqa.selenium.NoSuchElementException:找不到元素:{“方法”:“xpath”,“选择器”:“/*[@id='main-content']/div[@ng controller='AdminHome']”}

网页的HTML:

<html class="ng-scope" lang="en" ng-app="anMain">
<head>
<body>
    <div id="app" class="ng-scope" ng-controller="AppCntl">
            <div class="nav-container" style="z-index: 4000; position: relative;">
            <div class="container asAssembly" ng-class="{topMinus: greyBread === true, topMinusSelect: greyBread === true && greyBreadSelect == true, fixedWidth: fixedWidth === true}">
                <div class="gradient_back ng-hide" ng-show="greyBread"></div>
                <div id="main-content" class="ng-scope" ng-hide="AILoading" ng-view="">
                    <div class="container-fluid my_width posts-list-container ng-scope" ng-controller="AdminHome">
                    <h2>Admin home</h2>
                    <br/>
                    <!-- ngIf: areTabsVisible -->
                        <ul id="admin-home-tabs" class="nav nav-tabs ng-scope" ng-if="areTabsVisible" role="tablist">
                    <!-- end ngIf: areTabsVisible -->
                    <div class="center-top ng-hide" skip-ng-show="yes" ng-activity-indicator="" ng-show="tabLevelLoading">
                    <div class="btc-group radiogroup">
                    <!--<radio-button-group data-toggle="buttons-radio" model="myModel" options="myOptions" id="idProperty" name="nameProperty" suffix="bootstrapSuffix"></radio-button-group>-->
                    <div class="" ng-show="myModel == 1" ng-class="{tabspaddedtop: myOptions.length == 0}">
                    <div class="ng-hide" ng-show="myModel == 2">
                    <div class="ng-hide" ng-show="myModel == 3">
                    <div class="ng-hide" ng-show="myModel == 4">
                    <div class="ng-hide" ng-show="myModel == 5">
                    <div class="ng-hide" ng-show="myModel == 6">
                    </div>
                    </div>
                    <div id="show-message-dialog" class=" " style="display: none;;display: none;">
                </div>
            </div>
            <div class="center ng-hide" ng-show="AILoading" ng-activity-indicator="">
            <footer class="as-footer" ng-hide="AILoading" style="position: relative; bottom: 0px;">
     </div>
<!-- bower:js -->
<script src="static/js/bower_components/jquery/jquery.js"/>
<script src="static/js/bower_components/jquery-ui/jquery-ui.js"/>
<script src="static/js/bower_components/bootstrap/dist/js/bootstrap.js"/>
<script src="static/js/bower_components/typeahead.js/dist/typeahead.jquery.js"/>
<script src="static/js/bower_components/async/lib/async.js"/>
<script src="static/js/bower_components/lodash/dist/lodash.compat.js"/>
<script src="static/js/bower_components/moment/moment.js"/>
<script src="static/js/bower_components/angular/angular.js"/>
<script src="static/js/bower_components/ngActivityIndicator/ngActivityIndicator.js"/>
<script src="static/js/bower_components/angular-sanitize/angular-sanitize.js"/>
<script src="static/js/bower_components/angular-resource/angular-resource.js"/>
<script src="static/js/bower_components/angular-cookies/angular-cookies.js"/>
<script src="static/js/bower_components/angular-route/angular-route.js"/>

管理之家

以下是我尝试过的步骤:

  • 尝试了JavaScript,但在ubuntu服务器中查找任何元素也不起作用
  • 已验证:Windows和ubuntu服务器配置(如:-jre/jdk(1.8.0_65)、FF 30、ANT 1.7.1以及包括selenium-server-standalone-2.48.2和selenium-java-2.48.2在内的所有JAR)没有版本不兼容
  • Selenium code无法在标签内找到任何元素

  • **需要专业指导或解决方案者将不胜感激**

    您是否尝试过显式等待直到元素可见。?是的,我使用了正确的显式等待、隐式等待和页面加载,它工作得很好。所以您的问题解决了,对吗?不,在ubuntu服务器中仍然存在相同的问题(注:-在Windows ff浏览器中工作得很好)。我对这些“ng隐藏”也有类似的问题我的项目中的类和类似类。我在窗户上。我真的尝试了不同的东西,我在多年的经验中收集到了这些东西,但是webdriver到目前为止还不能优雅地处理棱角分明的东西。