Selenium webdriver not identifying the web element in the HTML page - selenium-webdriver
I am trying to automate the testing of a web application whose HTML is rendered via javascript and not Java. I am able to login into the application using selenium as the login is just a HTML page. But once I enter the application, selenium webdriver isn't able to identify the web elements.
I am using Selenium 2 + Java.
I have even tried saving the web application as a HTML page and try accessing the web elements. No luck there as well.
Framework used is cucumber.
package Junit;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.WebDriverWait;
import testBase.TestBase1;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
public class Feature3StepDef extends TestBase1{
#Given("^the application is open$")
public void the_application_is_open() throws Throwable {
System.setProperty("webdriver.ie.driver", "C:\\Selenium\\IEDriverServer.exe");
DesiredCapabilities ieCapabilities = DesiredCapabilities.internetExplorer();
ieCapabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
driver = new InternetExplorerDriver(ieCapabilities);
driver.get("http://******************/ccb-uata/SPLApp/cis.jsp");
System.out.println("I am In given");
}
#When("^User enters \"([^\"]*)\" and \"([^\"]*)\"$")
public void User_enters_and(String arg1, String arg2) throws Throwable {
new WebDriverWait(driver, 50);
WebElement user=driver.findElement(By.name("username"));
System.out.println("element is:" +user);
user.sendKeys(arg1);
WebElement psswd = driver.findElement(By.name("password"));
psswd.sendKeys(arg2);
WebElement button = driver.findElement(By.name("login"));
button.click();
System.out.println("I am In when");
Thread.sleep(10000);
WebElement elem = driver.findElement(By.xpath("//*body/div/table[#id='headerTable']"));
System.out.println("div element: " +elem);
Thread.sleep(100000);
System.out.println(arg1);
}
#Then("^the application should login$")
public void the_application_should_login() throws Throwable {
driver.quit();
System.out.println("I am In then");
}
}
HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html dir="ltr">
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!--
******************************************************************
* Program name: multiSearchNameData
* Program location: /ci/controlCentral
* Program version: 1
* Program template: UIXSD
* Template file: //Release_Services/release/FW/V2.1.0/splapp/applications/root/WEB-INF/uiXSL/newSearchData.xsl
* Template revision: 3
* Included XSL versions:
* common
* commonGrid 6
* commonGrid-xsl 5
*
* Labels:
* Table$Field - label (element type, js_name)
* $PER_ACCT_INFO - Person/Account (element type='IL' , jsName='ENTITY_INFO')
* $PREMISE_LBL - Premise (element type='IL' , jsName='PREM_INFO')
* $ID_TYPE_LBL - ID Type (element type='IL' , jsName='ID_TYPE')
* $ID_NBR_LBL - ID Nbr (element type='IL' , jsName='PER_ID_NBR')
* $ACCT_ID - Account ID (element type='HD' , jsName='ACCT_ID')
* $PER_ID - Person ID (element type='HD' , jsName='PER_ID')
* $PREM_ID - Premise ID (element type='HD' , jsName='PREM_ID')
* Widget Info:
* Widget_ID , Element Type - label info - label
* SEARCH_RESULTS:x$ENTITY_INFO, IL - $PER_ACCT_INFO - Person/Account
* SEARCH_RESULTS:x$ACCT_INFO, IL
* SEARCH_RESULTS:x$PREM_INFO, IL - $PREMISE_LBL - Premise
* SEARCH_RESULTS:x$ID_TYPE, IL - $ID_TYPE_LBL - ID Type
* SEARCH_RESULTS:x$PER_ID_NBR, IL - $ID_NBR_LBL - ID Nbr
* SEARCH_RESULTS:x$ACCT_ID, HD - $ACCT_ID - Account ID
* SEARCH_RESULTS:x$PER_ID, HD - $PER_ID - Person ID
* SEARCH_RESULTS:x$PREM_ID, HD - $PREM_ID - Premise ID
*
******************************************************************
-->
<title></title>
<link rel="stylesheet" type="text/css" href="../cisDisabled.css?ltr">
<link rel="stylesheet" type="text/css" href="../cisEnabled.css">
<script type="text/javascript" src="../code/xslListGridSupport.js"></script><script type="text/javascript" src="../code/xslSearchDataSupport.js"></script><script type="text/javascript" src="../code/common.js"></script><script type="text/javascript">
var isSearchData = true;
var main = parent.main;
var searchListModel = parent.searchListModel;
var searchClient
// Can go in support, onLoad?
if (parent.isEmbedded) {
searchClient = parent.parent
} else {
searchClient = parent.opener
}
var theListName = 'SEARCH_RESULTS';
var emptyLine = false;
var isCSSCompliant = false
var majorBrowserVersion = navigator.appVersion.match(/MSIE (\d+)/)[1]
if (majorBrowserVersion < 6){
isCSSCompliant = false
}
var myNavigationKeys = [
'multiSearchNameData'
]
var allFieldPairs = [
["xX", "xX", "xX"]
]
function contextKeys() {
return [
{jsName: "", altName: "", contextInstance: ""}
];
};
// cache element types and data class info
var elementMetaData
function initializeElementMetaData() {
self.elementMetaData = {
'ENTITY_INFO': {
jsName: 'ENTITY_INFO',
elementType: 'IL',
uiRow: '1',
uiColumn: '1',
fieldName: 'PER_ACCT_INFO',
fieldDataType: 'CHAR',
fieldExtendedDataType: '',
fieldPrecision: '60'
},
'ACCT_INFO': {
jsName: 'ACCT_INFO',
elementType: 'IL',
uiRow: '1',
uiColumn: '1',
fieldName: '',
fieldDataType: '',
fieldExtendedDataType: '',
fieldPrecision: ''
},
'PREM_INFO': {
jsName: 'PREM_INFO',
elementType: 'IL',
uiRow: '1',
uiColumn: '2',
fieldName: 'PREMISE_LBL',
fieldDataType: 'CHAR',
fieldExtendedDataType: '',
fieldPrecision: '1'
},
'ID_TYPE': {
jsName: 'ID_TYPE',
elementType: 'IL',
uiRow: '1',
uiColumn: '3',
fieldName: 'ID_TYPE_LBL',
fieldDataType: 'CHAR',
fieldExtendedDataType: '',
fieldPrecision: '1'
},
'PER_ID_NBR': {
jsName: 'PER_ID_NBR',
elementType: 'IL',
uiRow: '1',
uiColumn: '4',
fieldName: 'ID_NBR_LBL',
fieldDataType: 'CHAR',
fieldExtendedDataType: '',
fieldPrecision: '1'
},
'ACCT_ID': {
jsName: 'ACCT_ID',
elementType: 'HD',
uiRow: '1',
uiColumn: '5',
fieldName: 'ACCT_ID',
fieldDataType: 'CHAR',
fieldExtendedDataType: '',
fieldPrecision: '10'
},
'PER_ID': {
jsName: 'PER_ID',
elementType: 'HD',
uiRow: '1',
uiColumn: '6',
fieldName: 'PER_ID',
fieldDataType: 'CHAR',
fieldExtendedDataType: '',
fieldPrecision: '10'
},
'PREM_ID': {
jsName: 'PREM_ID',
elementType: 'HD',
uiRow: '1',
uiColumn: '7',
fieldName: 'PREM_ID',
fieldDataType: 'CHAR',
fieldExtendedDataType: '',
fieldPrecision: '10'
}
}
}
var fkElements
function initializeFKElements(){
self.fkElements = {
}
}
// Start Product User exits
// End Product User exits
</script><!-- Included file '/cm/ext_multiSearchNameData.jsp' not found --></head>
<body onload="loadFunctions();" onkeydown="main.onBodyKeyDown(event, document)" onclick="main.onBodyClick(event, document)">
<div xmlns:clientXSL="temp4" id="headerDivision">
<table id="headerTable" cellpadding="2" cellspacing="0">
<colgroup id="headerColumn1">
<col>
</colgroup>
<colgroup id="headerColumn2">
<col>
</colgroup>
<colgroup id="headerColumn3">
<col>
</colgroup>
<colgroup id="headerColumn4">
<col>
</colgroup>
<colgroup style="display: none;" id="headerColumn5">
<col>
</colgroup>
<colgroup style="display: none;" id="headerColumn6">
<col>
</colgroup>
<colgroup style="display: none;" id="headerColumn7">
<col>
</colgroup>
<thead id="headerTableHead">
<tr class="gridLabel">
<td onclick="clickedSortBy('SEARCH_RESULTS','ENTITY_INFO')" style="cursor:hand" nowrap valign="middle" class="gridTd"><span> <span id="L_ENTITY_INFO" name="L_ENTITY_INFO">Person/Account</span><img class="sortImage" src="../images/sortUp.gif" id="SS_ENTITY_INFO" name="SS_ENTITY_INFO"></span></td><td onclick="clickedSortBy('SEARCH_RESULTS','PREM_INFO')" style="cursor:hand" nowrap valign="middle" class="gridTd"><span> <span id="L_PREM_INFO" name="L_PREM_INFO">Premise</span><img class="sortImage" src="../images/sortUp.gif" id="SS_PREM_INFO" name="SS_PREM_INFO"></span></td><td onclick="clickedSortBy('SEARCH_RESULTS','ID_TYPE')" style="cursor:hand" nowrap valign="middle" class="gridTd"><span> <span id="L_ID_TYPE" name="L_ID_TYPE">ID Type</span><img class="sortImage" src="../images/sortUp.gif" id="SS_ID_TYPE" name="SS_ID_TYPE"></span></td><td onclick="clickedSortBy('SEARCH_RESULTS','PER_ID_NBR')" style="cursor:hand" nowrap valign="middle" class="gridTd"><span> <span id="L_PER_ID_NBR" name="L_PER_ID_NBR">ID Nbr</span><img class="sortImage" src="../images/sortUp.gif" id="SS_PER_ID_NBR" name="SS_PER_ID_NBR"></span></td><td onclick="clickedSortBy('SEARCH_RESULTS','ACCT_ID')" style="cursor:hand" nowrap valign="middle" class="gridTd"><span> <span id="L_ACCT_ID" name="L_ACCT_ID">Account ID</span><img class="sortImage" src="../images/sortUp.gif" id="SS_ACCT_ID" name="SS_ACCT_ID"></span></td><td onclick="clickedSortBy('SEARCH_RESULTS','PER_ID')" style="cursor:hand" nowrap valign="middle" class="gridTd"><span> <span id="L_PER_ID" name="L_PER_ID">Person ID</span><img class="sortImage" src="../images/sortUp.gif" id="SS_PER_ID" name="SS_PER_ID"></span></td><td onclick="clickedSortBy('SEARCH_RESULTS','PREM_ID')" style="cursor:hand" nowrap valign="middle" class="gridTd"><span> <span id="L_PREM_ID" name="L_PREM_ID">Premise ID</span><img class="sortImage" src="../images/sortUp.gif" id="SS_PREM_ID" name="SS_PREM_ID"></span></td>
</tr>
</thead>
</table>
</div>
<script type="text/javascript">
var _clientXSL;
function templateRow(){
if (_clientXSL) return _clientXSL;
_clientXSL = '\x3CclientXSL\x3Atemplate\x20match\x3D\x22\x2F\x22\x3E\x3CclientXSL\x3Avariable\x20name\x3D\x22startUIIndex\x22\x3E\x3CclientXSL\x3Achoose\x3E\x3CclientXSL\x3Awhen\x20test\x3D\x22\x2Flist\x2FstartUIIndex\x2F\x40value\x22\x3E\x3CclientXSL\x3Avalue\x2Dof\x20select\x3D\x22\x2Flist\x2FstartUIIndex\x2F\x40value\x22\x3E\x3C\x2FclientXSL\x3Avalue\x2Dof\x3E\x3C\x2FclientXSL\x3Awhen\x3E\x3CclientXSL\x3Aotherwise\x3E0\x3C\x2FclientXSL\x3Aotherwise\x3E\x3C\x2FclientXSL\x3Achoose\x3E\x3C\x2FclientXSL\x3Avariable\x3E\x3CclientXSL\x3Avariable\x20name\x3D\x22oddEvenOffset\x22\x3E\x3CclientXSL\x3Achoose\x3E\x3CclientXSL\x3Awhen\x20test\x3D\x22\x2Flist\x2FstartOnOddRow\x2F\x40value\x3D\x27true\x27\x22\x3E1\x3C\x2FclientXSL\x3Awhen\x3E\x3CclientXSL\x3Aotherwise\x3E0\x3C\x2FclientXSL\x3Aotherwise\x3E\x3C\x2FclientXSL\x3Achoose\x3E\x3C\x2FclientXSL\x3Avariable\x3E\x3Ctable\x20onkeypress\x3D\x22handleTRKeyPress\x28\x29\x22\x20onkeydown\x3D\x22handleTRKeyDown\x28\x29\x22\x20id\x3D\x22dataTable\x22\x20cellpadding\x3D\x222\x22\x20cellspacing\x3D\x220\x22\x3E\x3Ccolgroup\x20id\x3D\x22dataColumn1\x22\x3E\x3Ccol\x3E\x3C\x2Fcol\x3E\x3C\x2Fcolgroup\x3E\x3Ccolgroup\x20id\x3D\x22dataColumn2\x22\x3E\x3Ccol\x3E\x3C\x2Fcol\x3E\x3C\x2Fcolgroup\x3E\x3Ccolgroup\x20id\x3D\x22dataColumn3\x22\x3E\x3Ccol\x3E\x3C\x2Fcol\x3E\x3C\x2Fcolgroup\x3E\x3Ccolgroup\x20id\x3D\x22dataColumn4\x22\x3E\x3Ccol\x3E\x3C\x2Fcol\x3E\x3C\x2Fcolgroup\x3E\x3Ccolgroup\x20style\x3D\x22display\x3A\x20none\x3B\x22\x20id\x3D\x22dataColumn5\x22\x3E\x3Ccol\x3E\x3C\x2Fcol\x3E\x3C\x2Fcolgroup\x3E\x3Ccolgroup\x20style\x3D\x22display\x3A\x20none\x3B\x22\x20id\x3D\x22dataColumn6\x22\x3E\x3Ccol\x3E\x3C\x2Fcol\x3E\x3C\x2Fcolgroup\x3E\x3Ccolgroup\x20style\x3D\x22display\x3A\x20none\x3B\x22\x20id\x3D\x22dataColumn7\x22\x3E\x3Ccol\x3E\x3C\x2Fcol\x3E\x3C\x2Fcolgroup\x3E\x3Cthead\x20id\x3D\x22dataTableHead\x22\x3E\x3Ctr\x20style\x3D\x22visibility\x3A\x20hidden\x3B\x20height\x3A\x200\x25\x3B\x20position\x3A\x20absolute\x3B\x22\x20height\x3D\x220\x22\x20class\x3D\x22gridLabel\x22\x3E\x3Ctd\x20onclick\x3D\x22clickedSortBy\x28\x27SEARCH\x5FRESULTS\x27\x2C\x27ENTITY\x5FINFO\x27\x29\x22\x20style\x3D\x22cursor\x3Ahand\x22\x20nowrap\x3D\x22nowrap\x22\x20valign\x3D\x22middle\x22\x20class\x3D\x22gridTd\x22\x3E\x3Cspan\x3E \x3Cspan\x20id\x3D\x22D\x5FL\x5FENTITY\x5FINFO\x22\x20name\x3D\x22D\x5FL\x5FENTITY\x5FINFO\x22\x3EPerson\x26\x23x2F\x3BAccount\x3C\x2Fspan\x3E\x3Cimg\x20class\x3D\x22sortImage\x22\x20src\x3D\x22\x2E\x2E\x2Fimages\x2FsortUp\x2Egif\x22\x20id\x3D\x22D\x5FSS\x5FENTITY\x5FINFO\x22\x20name\x3D\x22D\x5FSS\x5FENTITY\x5FINFO\x22\x3E\x3C\x2Fimg\x3E\x3C\x2Fspan\x3E\x3C\x2Ftd\x3E\x3Ctd\x20onclick\x3D\x22clickedSortBy\x28\x27SEARCH\x5FRESULTS\x27\x2C\x27PREM\x5FINFO\x27\x29\x22\x20style\x3D\x22cursor\x3Ahand\x22\x20nowrap\x3D\x22nowrap\x22\x20valign\x3D\x22middle\x22\x20class\x3D\x22gridTd\x22\x3E\x3Cspan\x3E \x3Cspan\x20id\x3D\x22D\x5FL\x5FPREM\x5FINFO\x22\x20name\x3D\x22D\x5FL\x5FPREM\x5FINFO\x22\x3EPremise\x3C\x2Fspan\x3E\x3Cimg\x20class\x3D\x22sortImage\x22\x20src\x3D\x22\x2E\x2E\x2Fimages\x2FsortUp\x2Egif\x22\x20id\x3D\x22D\x5FSS\x5FPREM\x5FINFO\x22\x20name\x3D\x22D\x5FSS\x5FPREM\x5FINFO\x22\x3E\x3C\x2Fimg\x3E\x3C\x2Fspan\x3E\x3C\x2Ftd\x3E\x3Ctd\x20onclick\x3D\x22clickedSortBy\x28\x27SEARCH\x5FRESULTS\x27\x2C\x27ID\x5FTYPE\x27\x29\x22\x20style\x3D\x22cursor\x3Ahand\x22\x20nowrap\x3D\x22nowrap\x22\x20valign\x3D\x22middle\x22\x20class\x3D\x22gridTd\x22\x3E\x3Cspan\x3E \x3Cspan\x20id\x3D\x22D\x5FL\x5FID\x5FTYPE\x22\x20name\x3D\x22D\x5FL\x5FID\x5FTYPE\x22\x3EID\x20Type\x3C\x2Fspan\x3E\x3Cimg\x20class\x3D\x22sortImage\x22\x20src\x3D\x22\x2E\x2E\x2Fimages\x2FsortUp\x2Egif\x22\x20id\x3D\x22D\x5FSS\x5FID\x5FTYPE\x22\x20name\x3D\x22D\x5FSS\x5FID\x5FTYPE\x22\x3E\x3C\x2Fimg\x3E\x3C\x2Fspan\x3E\x3C\x2Ftd\x3E\x3Ctd\x20onclick\x3D\x22clickedSortBy\x28\x27SEARCH\x5FRESULTS\x27\x2C\x27PER\x5FID\x5FNBR\x27\x29\x22\x20style\x3D\x22cursor\x3Ahand\x22\x20nowrap\x3D\x22nowrap\x22\x20valign\x3D\x22middle\x22\x20class\x3D\x22gridTd\x22\x3E\x3Cspan\x3E \x3Cspan\x20id\x3D\x22D\x5FL\x5FPER\x5FID\x5FNBR\x22\x20name\x3D\x22D\x5FL\x5FPER\x5FID\x5FNBR\x22\x3EID\x20Nbr\x3C\x2Fspan\x3E\x3Cimg\x20class\x3D\x22sortImage\x22\x20src\x3D\x22\x2E\x2E\x2Fimages\x2FsortUp\x2Egif\x22\x20id\x3D\x22D\x5FSS\x5FPER\x5FID\x5FNBR\x22\x20name\x3D\x22D\x5FSS\x5FPER\x5FID\x5FNBR\x22\x3E\x3C\x2Fimg\x3E\x3C\x2Fspan\x3E\x3C\x2Ftd\x3E\x3Ctd\x20onclick\x3D\x22clickedSortBy\x28\x27SEARCH\x5FRESULTS\x27\x2C\x27ACCT\x5FID\x27\x29\x22\x20style\x3D\x22cursor\x3Ahand\x22\x20nowrap\x3D\x22nowrap\x22\x20valign\x3D\x22middle\x22\x20class\x3D\x22gridTd\x22\x3E\x3Cspan\x3E \x3Cspan\x20id\x3D\x22D\x5FL\x5FACCT\x5FID\x22\x20name\x3D\x22D\x5FL\x5FACCT\x5FID\x22\x3EAccount\x20ID\x3C\x2Fspan\x3E\x3Cimg\x20class\x3D\x22sortImage\x22\x20src\x3D\x22\x2E\x2E\x2Fimages\x2FsortUp\x2Egif\x22\x20id\x3D\x22D\x5FSS\x5FACCT\x5FID\x22\x20name\x3D\x22D\x5FSS\x5FACCT\x5FID\x22\x3E\x3C\x2Fimg\x3E\x3C\x2Fspan\x3E\x3C\x2Ftd\x3E\x3Ctd\x20onclick\x3D\x22clickedSortBy\x28\x27SEARCH\x5FRESULTS\x27\x2C\x27PER\x5FID\x27\x29\x22\x20style\x3D\x22cursor\x3Ahand\x22\x20nowrap\x3D\x22nowrap\x22\x20valign\x3D\x22middle\x22\x20class\x3D\x22gridTd\x22\x3E\x3Cspan\x3E \x3Cspan\x20id\x3D\x22D\x5FL\x5FPER\x5FID\x22\x20name\x3D\x22D\x5FL\x5FPER\x5FID\x22\x3EPerson\x20ID\x3C\x2Fspan\x3E\x3Cimg\x20class\x3D\x22sortImage\x22\x20src\x3D\x22\x2E\x2E\x2Fimages\x2FsortUp\x2Egif\x22\x20id\x3D\x22D\x5FSS\x5FPER\x5FID\x22\x20name\x3D\x22D\x5FSS\x5FPER\x5FID\x22\x3E\x3C\x2Fimg\x3E\x3C\x2Fspan\x3E\x3C\x2Ftd\x3E\x3Ctd\x20onclick\x3D\x22clickedSortBy\x28\x27SEARCH\x5FRESULTS\x27\x2C\x27PREM\x5FID\x27\x29\x22\x20style\x3D\x22cursor\x3Ahand\x22\x20nowrap\x3D\x22nowrap\x22\x20valign\x3D\x22middle\x22\x20class\x3D\x22gridTd\x22\x3E\x3Cspan\x3E \x3Cspan\x20id\x3D\x22D\x5FL\x5FPREM\x5FID\x22\x20name\x3D\x22D\x5FL\x5FPREM\x5FID\x22\x3EPremise\x20ID\x3C\x2Fspan\x3E\x3Cimg\x20class\x3D\x22sortImage\x22\x20src\x3D\x22\x2E\x2E\x2Fimages\x2FsortUp\x2Egif\x22\x20id\x3D\x22D\x5FSS\x5FPREM\x5FID\x22\x20name\x3D\x22D\x5FSS\x5FPREM\x5FID\x22\x3E\x3C\x2Fimg\x3E\x3C\x2Fspan\x3E\x3C\x2Ftd\x3E\x3C\x2Ftr\x3E\x3C\x2Fthead\x3E\x3Ctbody\x20id\x3D\x22dataTableBody\x22\x3E\x3CclientXSL\x3Afor\x2Deach\x20select\x3D\x22\x2Flist\x2Felement\x22\x3E\x3Ctr\x20onclick\x3D\x22handleTRClick\x28\x7Bposition\x28\x29\x20\x2D\x201\x20\x2B\x20\x24startUIIndex\x7D\x29\x22\x20uiRowIndex\x3D\x22\x7Bposition\x28\x29\x20\x2D\x201\x20\x2B\x20\x24startUIIndex\x7D\x22\x3E\x3CclientXSL\x3Aattribute\x20name\x3D\x22class\x22\x3E\x3CclientXSL\x3Achoose\x3E\x3CclientXSL\x3Awhen\x20test\x3D\x22\x28position\x28\x29\x20\x2B\x20\x24oddEvenOffset\x29\x20mod\x202\x20\x3D\x200\x22\x3EgridAlt\x3C\x2FclientXSL\x3Awhen\x3E\x3CclientXSL\x3Aotherwise\x3Egrid\x3C\x2FclientXSL\x3Aotherwise\x3E\x3C\x2FclientXSL\x3Achoose\x3E\x3C\x2FclientXSL\x3Aattribute\x3E\x3Ctd\x20id\x3D\x22SEARCH\x5FRESULTS\x7C\x7Bposition\x28\x29\x20\x2D\x201\x20\x2B\x20\x24startUIIndex\x7D\x22\x20valign\x3D\x22middle\x22\x3E\x3CclientXSL\x3Aattribute\x20name\x3D\x22class\x22\x3E\x20gridTd\x3C\x2FclientXSL\x3Aattribute\x3E\x3CclientXSL\x3Aattribute\x20name\x3D\x22nowrap\x22\x3Enowrap\x3C\x2FclientXSL\x3Aattribute\x3E\x26\x23xa0\x3B\x3Cspan\x20name\x3D\x22SEARCH\x5FRESULTS\x3A\x7Bposition\x28\x29\x20\x2D\x201\x20\x2B\x20\x24startUIIndex\x7D\x24ENTITY\x5FINFO\x22\x20id\x3D\x22SEARCH\x5FRESULTS\x3A\x7Bposition\x28\x29\x20\x2D\x201\x20\x2B\x20\x24startUIIndex\x7D\x24ENTITY\x5FINFO\x22\x20style\x3D\x22margin\x2Dright\x3A\x200\x2E20\x20em\x3B\x22\x3E\x3CclientXSL\x3Aattribute\x20name\x3D\x22class\x22\x3Edata\x20dc\x2DCHAR\x2DNONE\x2D60\x2D0\x20\x3C\x2FclientXSL\x3Aattribute\x3E\x3CclientXSL\x3Avalue\x2Dof\x20select\x3D\x22\x40ENTITY\x5FINFO\x22\x3E\x3C\x2FclientXSL\x3Avalue\x2Dof\x3E\x3C\x2Fspan\x3E\x3Cdiv\x20style\x3D\x22margin\x2Dleft\x3A\x203\x20ex\x3B\x22\x3E\x3Cspan\x20name\x3D\x22SEARCH\x5FRESULTS\x3A\x7Bposition\x28\x29\x20\x2D\x201\x20\x2B\x20\x24startUIIndex\x7D\x24ACCT\x5FINFO\x22\x20id\x3D\x22SEARCH\x5FRESULTS\x3A\x7Bposition\x28\x29\x20\x2D\x201\x20\x2B\x20\x24startUIIndex\x7D\x24ACCT\x5FINFO\x22\x20style\x3D\x22margin\x2Dright\x3A\x200\x2E20\x20em\x3B\x22\x3E\x3CclientXSL\x3Aattribute\x20name\x3D\x22class\x22\x3Edata\x20\x20\x3C\x2FclientXSL\x3Aattribute\x3E\x3CclientXSL\x3Avalue\x2Dof\x20select\x3D\x22\x40ACCT\x5FINFO\x22\x3E\x3C\x2FclientXSL\x3Avalue\x2Dof\x3E\x3C\x2Fspan\x3E\x3C\x2Fdiv\x3E\x3C\x2Ftd\x3E\x3Ctd\x20width\x3D\x22350\x22\x20id\x3D\x22SEARCH\x5FRESULTS\x7C\x7Bposition\x28\x29\x20\x2D\x201\x20\x2B\x20\x24startUIIndex\x7D\x22\x20valign\x3D\x22middle\x22\x20align\x3D\x22\x22\x3E\x3CclientXSL\x3Aattribute\x20name\x3D\x22class\x22\x3E\x20gridTd\x3C\x2FclientXSL\x3Aattribute\x3E\x3CclientXSL\x3Aattribute\x20name\x3D\x22nowrap\x22\x3Enowrap\x3C\x2FclientXSL\x3Aattribute\x3E\x26\x23xa0\x3B\x3Cspan\x20name\x3D\x22SEARCH\x5FRESULTS\x3A\x7Bposition\x28\x29\x20\x2D\x201\x20\x2B\x20\x24startUIIndex\x7D\x24PREM\x5FINFO\x22\x20id\x3D\x22SEARCH\x5FRESULTS\x3A\x7Bposition\x28\x29\x20\x2D\x201\x20\x2B\x20\x24startUIIndex\x7D\x24PREM\x5FINFO\x22\x20style\x3D\x22margin\x2Dright\x3A\x200\x2E20\x20em\x3B\x22\x3E\x3CclientXSL\x3Aattribute\x20name\x3D\x22class\x22\x3Edata\x20dc\x2DCHAR\x2DNONE\x2D1\x2D0\x20\x3C\x2FclientXSL\x3Aattribute\x3E\x3CclientXSL\x3Avalue\x2Dof\x20select\x3D\x22\x40PREM\x5FINFO\x22\x3E\x3C\x2FclientXSL\x3Avalue\x2Dof\x3E\x3C\x2Fspan\x3E\x3C\x2Ftd\x3E\x3Ctd\x20id\x3D\x22SEARCH\x5FRESULTS\x7C\x7Bposition\x28\x29\x20\x2D\x201\x20\x2B\x20\x24startUIIndex\x7D\x22\x20valign\x3D\x22middle\x22\x20align\x3D\x22\x22\x3E\x3CclientXSL\x3Aattribute\x20name\x3D\x22class\x22\x3E\x20gridTd\x3C\x2FclientXSL\x3Aattribute\x3E\x3CclientXSL\x3Aattribute\x20name\x3D\x22nowrap\x22\x3Enowrap\x3C\x2FclientXSL\x3Aattribute\x3E\x26\x23xa0\x3B\x3Cspan\x20name\x3D\x22SEARCH\x5FRESULTS\x3A\x7Bposition\x28\x29\x20\x2D\x201\x20\x2B\x20\x24startUIIndex\x7D\x24ID\x5FTYPE\x22\x20id\x3D\x22SEARCH\x5FRESULTS\x3A\x7Bposition\x28\x29\x20\x2D\x201\x20\x2B\x20\x24startUIIndex\x7D\x24ID\x5FTYPE\x22\x20style\x3D\x22margin\x2Dright\x3A\x200\x2E20\x20em\x3B\x22\x3E\x3CclientXSL\x3Aattribute\x20name\x3D\x22class\x22\x3Edata\x20dc\x2DCHAR\x2DNONE\x2D1\x2D0\x20\x3C\x2FclientXSL\x3Aattribute\x3E\x3CclientXSL\x3Avalue\x2Dof\x20select\x3D\x22\x40ID\x5FTYPE\x22\x3E\x3C\x2FclientXSL\x3Avalue\x2Dof\x3E\x3C\x2Fspan\x3E\x3C\x2Ftd\x3E\x3Ctd\x20id\x3D\x22SEARCH\x5FRESULTS\x7C\x7Bposition\x28\x29\x20\x2D\x201\x20\x2B\x20\x24startUIIndex\x7D\x22\x20valign\x3D\x22middle\x22\x20align\x3D\x22\x22\x3E\x3CclientXSL\x3Aattribute\x20name\x3D\x22class\x22\x3E\x20gridTd\x3C\x2FclientXSL\x3Aattribute\x3E\x3CclientXSL\x3Aattribute\x20name\x3D\x22nowrap\x22\x3Enowrap\x3C\x2FclientXSL\x3Aattribute\x3E\x26\x23xa0\x3B\x3Cspan\x20name\x3D\x22SEARCH\x5FRESULTS\x3A\x7Bposition\x28\x29\x20\x2D\x201\x20\x2B\x20\x24startUIIndex\x7D\x24PER\x5FID\x5FNBR\x22\x20id\x3D\x22SEARCH\x5FRESULTS\x3A\x7Bposition\x28\x29\x20\x2D\x201\x20\x2B\x20\x24startUIIndex\x7D\x24PER\x5FID\x5FNBR\x22\x20style\x3D\x22margin\x2Dright\x3A\x200\x2E20\x20em\x3B\x22\x3E\x3CclientXSL\x3Aattribute\x20name\x3D\x22class\x22\x3Edata\x20dc\x2DCHAR\x2DNONE\x2D1\x2D0\x20\x3C\x2FclientXSL\x3Aattribute\x3E\x3CclientXSL\x3Avalue\x2Dof\x20select\x3D\x22\x40PER\x5FID\x5FNBR\x22\x3E\x3C\x2FclientXSL\x3Avalue\x2Dof\x3E\x3C\x2Fspan\x3E\x3C\x2Ftd\x3E\x3Ctd\x20id\x3D\x22SEARCH\x5FRESULTS\x7C\x7Bposition\x28\x29\x20\x2D\x201\x20\x2B\x20\x24startUIIndex\x7D\x22\x20valign\x3D\x22middle\x22\x20align\x3D\x22\x22\x3E\x3CclientXSL\x3Aattribute\x20name\x3D\x22class\x22\x3E\x20gridTd\x3C\x2FclientXSL\x3Aattribute\x3E\x3CclientXSL\x3Aattribute\x20name\x3D\x22nowrap\x22\x3Enowrap\x3C\x2FclientXSL\x3Aattribute\x3E\x26\x23xa0\x3B\x3Cspan\x20name\x3D\x22SEARCH\x5FRESULTS\x3A\x7Bposition\x28\x29\x20\x2D\x201\x20\x2B\x20\x24startUIIndex\x7D\x24ACCT\x5FID\x22\x20id\x3D\x22SEARCH\x5FRESULTS\x3A\x7Bposition\x28\x29\x20\x2D\x201\x20\x2B\x20\x24startUIIndex\x7D\x24ACCT\x5FID\x22\x20style\x3D\x22margin\x2Dright\x3A\x200\x2E20\x20em\x3B\x20display\x3A\x20none\x3B\x22\x3E\x3CclientXSL\x3Aattribute\x20name\x3D\x22class\x22\x3Edata\x20dc\x2DCHAR\x2DNONE\x2D10\x2D0\x20\x3C\x2FclientXSL\x3Aattribute\x3E\x3C\x2Fspan\x3E\x3C\x2Ftd\x3E\x3Ctd\x20id\x3D\x22SEARCH\x5FRESULTS\x7C\x7Bposition\x28\x29\x20\x2D\x201\x20\x2B\x20\x24startUIIndex\x7D\x22\x20valign\x3D\x22middle\x22\x20align\x3D\x22\x22\x3E\x3CclientXSL\x3Aattribute\x20name\x3D\x22class\x22\x3E\x20gridTd\x3C\x2FclientXSL\x3Aattribute\x3E\x3CclientXSL\x3Aattribute\x20name\x3D\x22nowrap\x22\x3Enowrap\x3C\x2FclientXSL\x3Aattribute\x3E\x26\x23xa0\x3B\x3Cspan\x20name\x3D\x22SEARCH\x5FRESULTS\x3A\x7Bposition\x28\x29\x20\x2D\x201\x20\x2B\x20\x24startUIIndex\x7D\x24PER\x5FID\x22\x20id\x3D\x22SEARCH\x5FRESULTS\x3A\x7Bposition\x28\x29\x20\x2D\x201\x20\x2B\x20\x24startUIIndex\x7D\x24PER\x5FID\x22\x20style\x3D\x22margin\x2Dright\x3A\x200\x2E20\x20em\x3B\x20display\x3A\x20none\x3B\x22\x3E\x3CclientXSL\x3Aattribute\x20name\x3D\x22class\x22\x3Edata\x20dc\x2DCHAR\x2DNONE\x2D10\x2D0\x20\x3C\x2FclientXSL\x3Aattribute\x3E\x3C\x2Fspan\x3E\x3C\x2Ftd\x3E\x3Ctd\x20id\x3D\x22SEARCH\x5FRESULTS\x7C\x7Bposition\x28\x29\x20\x2D\x201\x20\x2B\x20\x24startUIIndex\x7D\x22\x20valign\x3D\x22middle\x22\x20align\x3D\x22\x22\x3E\x3CclientXSL\x3Aattribute\x20name\x3D\x22class\x22\x3E\x20gridTd\x3C\x2FclientXSL\x3Aattribute\x3E\x3CclientXSL\x3Aattribute\x20name\x3D\x22nowrap\x22\x3Enowrap\x3C\x2FclientXSL\x3Aattribute\x3E\x26\x23xa0\x3B\x3Cspan\x20name\x3D\x22SEARCH\x5FRESULTS\x3A\x7Bposition\x28\x29\x20\x2D\x201\x20\x2B\x20\x24startUIIndex\x7D\x24PREM\x5FID\x22\x20id\x3D\x22SEARCH\x5FRESULTS\x3A\x7Bposition\x28\x29\x20\x2D\x201\x20\x2B\x20\x24startUIIndex\x7D\x24PREM\x5FID\x22\x20style\x3D\x22margin\x2Dright\x3A\x200\x2E20\x20em\x3B\x20display\x3A\x20none\x3B\x22\x3E\x3CclientXSL\x3Aattribute\x20name\x3D\x22class\x22\x3Edata\x20dc\x2DCHAR\x2DNONE\x2D10\x2D0\x20\x3C\x2FclientXSL\x3Aattribute\x3E\x3C\x2Fspan\x3E\x3C\x2Ftd\x3E\x3C\x2Ftr\x3E\x3C\x2FclientXSL\x3Afor\x2Deach\x3E\x3C\x2Ftbody\x3E\x3C\x2Ftable\x3E\x3C\x2FclientXSL\x3Atemplate\x3E'
// wrap template row with stylesheet
_clientXSL = ' <clientXSL:stylesheet xmlns:clientXSL="http://www.w3.org/1999/XSL/Transform" version="1.0">\n'
+ '<clientXSL:output method="html" encoding="UTF-8"/>\n'
+ _clientXSL + '\n</clientXSL:stylesheet>'
return _clientXSL;
}
var listName = 'SEARCH_RESULTS';
</script><span style="position:absolute;"><img src="../images/expandScroll.gif" id="scrollControl" name="scrollControl" style="position:absolute; top:-17px; right:-1px; visibility:hidden;"><div id="dataDivision" onscroll="onTableScroll();"></div>
</span>
<iframe scrolling="auto" id="context" src="../blankEmpty.html" class="contextMenu" frameborder="0" width="1" height="1"></iframe>
</body>
</html>
Error:
org.openqa.selenium.TimeoutException: Timed out after 100 seconds waiting for presence of element located by: By.xpath: *[#id='headerDivision']
Build info: version: '2.32.0', revision: '6c40c18', time: '2013-04-09 17:23:22'
System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version: '1.6.0_27'
Driver info: driver.version: unknown
at org.openqa.selenium.support.ui.FluentWait.timeoutException(FluentWait.java:259)
at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:228)
at Junit.Feature3StepDef.User_enters_and(Feature3StepDef.java:53)
at ?.When User enters "syahm" and "Powerful4"(Resources\Features\Feature3.feature:5)
Caused by: org.openqa.selenium.NoSuchElementException: Unable to find element with xpath == *[#id='headerDivision'] (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 343 milliseconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.32.0', revision: '6c40c18', time: '2013-04-09 17:23:22'
System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version: '1.6.0_27'
Session ID: bb4475ec-3408-43f3-a7d2-22e2c0b94b66
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{platform=WINDOWS, javascriptEnabled=true, cssSelectorsEnabled=true, handlesAlerts=true, browserName=internet explorer, nativeEvents=true, takesScreenshot=true, version=7}]
Wait Time
Selenium only interacts with the DOM so we don't care about the code behind. As far as the html rendered, it's probably a timing issue. Run the test in debug mode and put a break point at the beginning of the test. Then manually step through each step one at a time once the page has had time to load.
If it's a timing issue, you can doe one of two things:
Wait for page load by checking the document ready status. Here is a C# way of doing that.
Your second option is to wait for the element you're looking for to be present. You can see a good example of this in this other question.
Here is the suggestion from that post:
WebElement foundElement = new WebDriverWait(webdriver, 30).until(ExpectedConditions.visibilityOfElementLocated(By.Id("myId")));
Selector
If it's not the wait time, it could be the selector isn't correct and you're not grabbing the right element. XPath is the easiest way to fix that.
Open page in Chrome
Right click on element and choose inspect element
Chrome should show the html and you should be on that element. Right click and Copy XPath
Change your selector to driver.FindElement(By.XPath("selector you just found")); Note you may need to tweak it slightly so you're not escaping quotes.
Run again with new selector in Chrome. If it doesn't work, pause right before you select it and search again for the XPath and compare what you had before with what you have now.
Related
replace <h2> tags before strip_tags
I'm trying to replace the <h2> and </h2> tag from a string this way but it's not working: $desc = get_post_meta($post_id , 'desc', true); preg_replace("/<h2>/", '', $desc); preg_replace("/</h2>/", ' - ', $desc); Then I like to the strip all other tags this way strip_tags($desc)
Do it this way: $trash_h2_tags = array("<h2>", "</h2>"); $desc = str_replace($trash_h2_tags, '', $desc);
How to automatically update Google Gauge
I'm kinda rookie in this, but I need help with Google Gauge that should take latest entry in database and display it, while updating automatically without the need to reload the site. Right now I have code that displays it, but for it to update to new values I need to reload the page. Here's what I have so far: <html> <head> <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <script type="text/javascript"> google.charts.load('current', {'packages':['gauge']}); google.charts.setOnLoadCallback(drawChart); function drawChart() { var data = google.visualization.arrayToDataTable([ ['Label', 'Value'], ['ProductPurity', <?php $servername = "localhost"; $username = "u644759843_miki"; $password = "plantaze2020!"; $dbname = "u644759843_plantazeDB"; // Create connection $conn = mysqli_connect($servername, $username, $password, $dbname); // Check connection if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } $sql = "SELECT ProductPurity FROM `Precizno ProductPurity` ORDER BY TimesStamp DESC LIMIT 1"; $result = mysqli_query($conn, $sql); if (mysqli_num_rows($result) > 0) { // output data of each row while($row = mysqli_fetch_assoc($result)) { echo $row["ProductPurity"]; } } else { echo "0 results"; } mysqli_close($conn); ?> ], ]); var options = { width: 400, height: 120, redFrom: 90, redTo: 100, yellowFrom:75, yellowTo: 90, minorTicks: 5 }; var chart = new google.visualization.Gauge(document.getElementById('chart_div')); chart.draw(data, options); setInterval(function() { data.setValue(0 ,1 , <?php // Create connection $conn = mysqli_connect($servername, $username, $password, $dbname); // Check connection if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } $sql = "SELECT ProductPurity FROM `Precizno ProductPurity` ORDER BY TimesStamp DESC LIMIT 1"; $result = mysqli_query($conn, $sql); if (mysqli_num_rows($result) > 0) { // output data of each row while($row = mysqli_fetch_assoc($result)) { echo $row["ProductPurity"]; } } else { echo "0 results"; } mysqli_close($conn); ?> ); chart.draw(data, options); }, 5000); setInterval(function() { data.setValue(1, 1, 40 + Math.round(60 * Math.random())); chart.draw(data, options); }, 5000); setInterval(function() { data.setValue(2, 1, 60 + Math.round(20 * Math.random())); chart.draw(data, options); }, 26000); } </script> </head> <body> <div id="chart_div" style="width: 400px; height: 120px;"></div> </body> </html>
php runs on the server, so it is only going to run once per page load. to update the chart without reloading the page, you will need to separate the php from the html / javascript. save the php to a different file, all by itself. you need to include the rest of the data in the php, including the column headings. see following snippet for the php. for example purposes, we'll name the file --> getdata.php <?php $servername = "localhost"; $username = "u644759843_miki"; $password = "plantaze2020!"; $dbname = "u644759843_plantazeDB"; // Create connection mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); $conn = mysqli_connect($servername, $username, $password, $dbname); $conn->set_charset('utf8mb4'); $sql = "SELECT ProductPurity FROM `Precizno ProductPurity` ORDER BY TimesStamp DESC LIMIT 1"; $result = mysqli_query($conn, $sql); // create data array $data = []; $data[] = ["Label", "Value"]; // output data of each row while($row = mysqli_fetch_assoc($result)) { $data[] = ["ProductPurity", $row["ProductPurity"]]; } mysqli_close($conn); // write data array to page echo json_encode($data); ?> next, save the html / javascript to its own file. for example purposes, we'll name the file --> chart.html to get the data from php, we'll use jquery ajax. see following snippet... <!DOCTYPE html> <html lang="en"> <head> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.0/jquery.min.js"></script> <script src="https://www.gstatic.com/charts/loader.js"></script> <script> google.charts.load('current', { packages: ['gauge'] }).then(function () { var options = { width: 400, height: 120, redFrom: 90, redTo: 100, yellowFrom:75, yellowTo: 90, minorTicks: 5 }; var chart = new google.visualization.Gauge(document.getElementById('chart_div')); drawChart(); function drawChart() { $.ajax({ url: 'getdata.php', dataType: 'json' }).done(function (jsonData) { // use response from php for data table var data = google.visualization.arrayToDataTable(jsonData); chart.draw(data, options); // draw again in 5 seconds window.setTimeout(drawChart, 5000); }); } }); </script> </head> <body> <div id="chart_div" style="width: 400px; height: 120px;"></div> </body> </html> EDIT need to make sure the Value column... is a number --> 99.9594 not a string --> "99.9594" you can convert using --> (float) // output data of each row while($row = mysqli_fetch_assoc($result)) { $data[] = ["ProductPurity", (float) $row["ProductPurity"]]; } and / or use the JSON_NUMERIC_CHECK constant on the encode statement... echo json_encode($data, JSON_NUMERIC_CHECK);
OpenLayers 3 ArcGIS Cache Server Local Files
Some days ago I did an ArcGISCache visor with OpenLayers 2.12 with some tiles in this folder and file format: _alllayers\L04\R00000009\C00000a07.png This means that my tiles are inside "_alllayers" folder and then inside other folders that means Zoom Level (L00,L01...L21). Inside them i have some other folders with their name like: "R00000009" and then inside those folders I have the images named like: "C00000a07.png". When I did the visor for OpenLayers 2.12 or OpenLayers 2.14 I did it well and works right. But when I have tried to do the same with OpenLayers 3, it doesn't work. OpenLayers 2.12 / OpenLayers 2.14 <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"> <script src="http://maps.google.com/maps/api/js?v=3&sensor=false"></script> <meta name="apple-mobile-web-app-capable" content="yes"> <title>OpenLayers</title> <style> html, body, #map { margin: 0; width: 100%; height: 100%; } </style> <script src="lib/OpenLayers.2.14.js"></script> <script> var map, cacheLayer, testLayer, //This layer requires meta data about the ArcGIS service. Typically you should use a //JSONP call to get this dynamically. For this example, we are just going to hard-code //an example that we got from here (yes, it's very big): // http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer?f=json&pretty=true layerInfo = { "currentVersion" : 10.01, "serviceDescription" : "This worldwide street map presents highway-level data for the world and street-level data for the United States, Canada, Japan, Southern Africa, and a number of countries in Europe and elsewhere. This comprehensive street map includes highways, major roads, minor roads, railways, water features, administrative boundaries, cities, parks, and landmarks, overlaid on shaded relief imagery for added context. The street map was developed by ESRI using ESRI basemap data, AND road data, USGS elevation data, and UNEP-WCMC parks and protected areas for the world, and Tele Atlas Dynamap� and Multinet� street data for North America and Europe. Coverage for street-level data in Europe includes Andorra, Austria, Belgium, Czech Republic, Denmark, France, Germany, Great Britain, Greece, Hungary, Ireland, Italy, Luxembourg, Netherlands, Northern Ireland (Belfast only), Norway, Poland, Portugal, San Marino, Slovakia, Spain, Sweden, and Switzerland. Coverage for street-level data elsewhere in the world includes China (Hong Kong only), Colombia, Egypt (Cairo only), Indonesia (Jakarta only), Japan, Mexico (Mexico City only), Russia (Moscow and St. Petersburg only), South Africa, Thailand, and Turkey (Istanbul and Ankara only). For more information on this map, visit us \u003ca href=\"http://goto.arcgisonline.com/maps/World_Street_Map \" target=\"_new\"\u003eonline\u003c/a\u003e.", "mapName" : "Layers", "description" : "This worldwide street map presents highway-level data for the world and street-level data for the United States, Canada, Japan, Southern Africa, most countries in Europe, and several other countries. This comprehensive street map includes highways, major roads, minor roads, one-way arrow indicators, railways, water features, administrative boundaries, cities, parks, and landmarks, overlaid on shaded relief imagery for added context. The map also includes building footprints for selected areas in the United States and Europe and parcel boundaries for much of the lower 48 states.\n\nThe street map was developed by ESRI using ESRI basemap data, DeLorme base map layers, AND road data, USGS elevation data, UNEP-WCMC parks and protected areas for the world, Tele Atlas Dynamap� and Multinet� street data for North America and Europe, and First American parcel data for the United States. Coverage for street-level data in Europe includes Andorra, Austria, Belgium, Czech Republic, Denmark, France, Germany, Great Britain, Greece, Hungary, Ireland, Italy, Luxembourg, Netherlands, Norway, Poland, Portugal, San Marino, Slovakia, Spain, Sweden, and Switzerland. Coverage for street-level data elsewhere in the world includes China (Hong Kong only), Colombia, Egypt (Cairo only), Indonesia (Jakarta only), Japan, Mexico, Russia, South Africa, Thailand, and Turkey (Istanbul and Ankara only). For more information on this map, visit us online at http://goto.arcgisonline.com/maps/World_Street_Map\n", "copyrightText" : "Sources: ESRI, DeLorme, AND, Tele Atlas, First American, ESRI Japan, UNEP-WCMC, USGS, METI, ESRI Hong Kong, ESRI Thailand, Procalculo Prosis", "layers" : [ { "id" : 0, "name" : "World Street Map", "parentLayerId" : -1, "defaultVisibility" : true, "subLayerIds" : null, "minScale" : 0, "maxScale" : 0 } ], "tables" : [ ], "spatialReference" : { "wkid" : 102100 }, "singleFusedMapCache" : true, "tileInfo" : { "rows" : 256, "cols" : 256, "dpi" : 96, "format" : "JPEG", "compressionQuality" : 90, "origin" : { "x" : -20037700, "y" : 30241100 }, "spatialReference" : { "wkid" : 102100 }, "lods" : [ {'level' : 0, 'resolution' : 156543.03403606807, 'scale' : 591657528}, {'level' : 1, 'resolution' : 78271.517018034036, 'scale' : 295828764}, {'level' : 2, 'resolution' : 39135.758509017018, 'scale' : 147914382}, {'level' : 3, 'resolution' : 19567.879254508509, 'scale' : 73957191}, {'level' : 4, 'resolution' : 9783.9394949623238, 'scale' : 36978595}, {'level' : 5, 'resolution' : 4891.9698797730935, 'scale' : 18489298}, {'level' : 6, 'resolution' : 2445.9849398865467, 'scale' : 9244649}, {'level' : 7, 'resolution' : 1222.992337651342, 'scale' : 4622324}, {'level' : 8, 'resolution' : 611.49616882567102, 'scale' : 2311162}, {'level' : 9, 'resolution' : 305.74808441283551, 'scale' : 1155581}, {'level' : 10, 'resolution' : 152.87417449834899, 'scale' : 577791}, {'level' : 11, 'resolution' : 76.436954957243259, 'scale' : 288895}, {'level' : 12, 'resolution' : 38.218609770552874, 'scale' : 144448}, {'level' : 13, 'resolution' : 19.109304885276437, 'scale' : 72224}, {'level' : 14, 'resolution' : 9.5546524426382184, 'scale' : 36112}, {'level' : 15, 'resolution' : 4.7773262213191092, 'scale' : 18056}, {'level' : 16, 'resolution' : 2.3886631106595546, 'scale' : 9028}, {'level' : 17, 'resolution' : 1.1943315553297773, 'scale' : 4514}, {'level' : 18, 'resolution' : 0.59716577766488865, 'scale' : 2257}, {'level' : 19, 'resolution' : 0.2984505969011938, 'scale' : 1128}, {'level' : 20, 'resolution' : 0.1492252984505969, 'scale' : 564}, {'level' : 21, 'resolution' : 0.061383456100245537, 'scale' : 282} ] }, "initialExtent" : { "xmin" : -20037507.0671618, "ymin" : -20037507.0671618, "xmax" : 20037507.0671618, "ymax" : 20037507.0671619, "spatialReference" : { "wkid" : 102100 } }, "fullExtent" : { "xmin" : -20037507.0671618, "ymin" : -20037507.0671618, "xmax" : 20037507.0671618, "ymax" : 20037507.0671619, "spatialReference" : { "wkid" : 102100 } }, "units" : "esriMeters", "supportedImageFormatTypes" : "PNG24,PNG,JPG,DIB,TIFF,EMF,PS,PDF,GIF,SVG,SVGZ,AI,BMP", "documentInfo" : { "Title" : "World Street Map", "Author" : "ESRI", "Comments" : "", "Subject" : "streets, highways, major roads, railways, water features, administrative boundaries, cities, parks, protected areas, landmarks ", "Category" : "transportation(Transportation Networks) ", "Keywords" : "World, Global, 2009, Japan, UNEP-WCMC", "Credits" : "" }, "capabilities" : "Map" }; function init() { var maxExtent = new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34); var layerMaxExtent = new OpenLayers.Bounds( layerInfo.fullExtent.xmin, layerInfo.fullExtent.ymin, layerInfo.fullExtent.xmax, layerInfo.fullExtent.ymax ); var resolutions = []; for (var i=0; i<layerInfo.tileInfo.lods.length; i++) { resolutions.push(layerInfo.tileInfo.lods[i].resolution); } map = new OpenLayers.Map('map', { maxExtent: maxExtent, StartBounds: layerMaxExtent, units: (layerInfo.units == "esriFeet") ? 'ft' : 'm', resolutions: resolutions, tileSize: new OpenLayers.Size(layerInfo.tileInfo.width, layerInfo.tileInfo.height), projection: 'EPSG:' + layerInfo.spatialReference.wkid }); cacheLayer = new OpenLayers.Layer.ArcGISCache( "AGSCache", "http://MY_IP:MY_PORT/MY_FOLDER/Layers/_alllayers", { isBaseLayer: false, useArcGISServer: false, resolutions: resolutions, tileSize: new OpenLayers.Size(layerInfo.tileInfo.cols, layerInfo.tileInfo.rows), tileOrigin: new OpenLayers.LonLat(layerInfo.tileInfo.origin.x , layerInfo.tileInfo.origin.y), maxExtent: layerMaxExtent, projection: 'EPSG:' + layerInfo.spatialReference.wkid }); testLayer = new OpenLayers.Layer.Google( "Google Streets", {'sphericalMercator': true, numZoomLevels: 21} ); map.addLayers([cacheLayer, testLayer]); map.addControl(new OpenLayers.Control.LayerSwitcher()); map.addControl( new OpenLayers.Control.MousePosition() ); map.zoomToExtent(new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34)); } </script> </head> <body onload="init()"> <div id="map"></div> </body> </html> As I said, this works fine. But when I try to do the same at OpenLayers 3, I can't. I don't know why is asking for the images like there is a service. OpenLayers 3 <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"> <script src="http://maps.google.com/maps/api/js?v=3&sensor=false"></script> <meta name="apple-mobile-web-app-capable" content="yes"> <title>OpenLayers</title> <style> html, body, #map { margin: 0; width: 100%; height: 100%; } </style> <script src="lib/OpenLayers.3.js"></script> <script> function init(){ var url = 'http://MY_IP:MY_PORT/MY_FOLDER/Layers/_alllayers'; var layers = [ new ol.layer.Tile({ source: new ol.source.OSM() }), new ol.layer.Tile({ extent: [-20037507.0671618,-20037507.0671618,20037507.0671618,20037507.0671619], source: new ol.source.TileArcGISRest({ url: url }) }) ]; var map = new ol.Map({ layers: layers, target: 'map', view: new ol.View({ center: [-20037700, 30241100], zoom: 1 }) }); } </script> </head> <body onload="init()"> <div id="map"></div> </body> </html> When I try to load this OpenLayers 3 visor, I can see in the console some 404 error and this is the type of URL that it tries to find: http://MY_IP:MY_PORT/MY_FOLDER/Layers/_alllayers/?F=image&FORMAT=PNG32&TRANSPARENT=true&SIZE=256%2C256&BBOX=-20037508.342789244%2C0%2C0%2C20037508.342789244&BBOXSR=3857&IMAGESR=3857&DPI=90 Pretty Print http://MY_IP:MY_PORT/MY_FOLDER/Layers/_alllayers/?F=image &FORMAT=PNG32 &TRANSPARENT=true &SIZE=256%2C256 &BBOX=-20037508.342789244%2C0%2C0%2C20037508.342789244 &BBOXSR=3857 &IMAGESR=3857 &DPI=90 So, my questions are: - Why OpenLayers 3 is asking for the images (tiles) like it was a Service behind? - Hoy can I use my tiles in OpenLayers 3? I have tried to change the URL with this patterns: http://MY_IP:MY_PORT/MY_FOLDER/Layers/_alllayers/ImageServer http://MY_IP:MY_PORT/MY_FOLDER/Layers/_alllayers/ImageServer/export http://MY_IP:MY_PORT/MY_FOLDER/Layers/_alllayers/Tiles/{z}/{x}/{y} Edit: Finally I have solved! I hava made in Java a program that converts all those folders and pictures names. I was trying to understand the pattern that the names of folders and images has, and finally I realized that the first letter of the folders meant the rows ( R -> row) and the first letter of the images meant columns ( C -> column). Once you have removed the first letter , just needed to convert that number Hexadecimal to Decimal and save the file or folder with that new name. If someones need some help with this, I will happy to help.
ol.source.ArcGISRest is for ArcGIS server tile services. For ArcGISCache, you will want to use an ol.source.TileImage or ol.source.XYZ with a custom tileUrlFunction or tileLoadFunction. I prefer the latter, because then I do not have to convert tile coordinates. Something like function replacer(match, letter, value) { var str = Number(value).toString(letter == 'L' ? 10 : 16); var len = letter == 'L' ? 2 : 8; while (str.length < len) { str = '0' + str; } return letter + str; } var source = new ol.source.XYZ({ url: 'http://MY_IP:MY_PORT/MY_FOLDER/Layers/_alllayers/L{z}/R{x}/C{y}.png', tileLoadFunction: function(image, url) { image.getImage().src = url .replace(/(L)([0-9]+)/, replacer) .replace(/(R)([0-9]+)/, replacer) .replace(/(C)([0-9]+)/, replacer); } });
#ahocevar solutions works. But I had to swap the x and y in the URL. url: 'http://MY_IP:MY_PORT/MY_FOLDER/Layers/_alllayers/L{z}/R{y}/C{x}.png' This makes sense, because y would map to rows and x to colums.
AngularJS Drag and Drop
If I have a JSON like below .. $scope.pools = [ {id: 1, poolName : 'Pool1', env : 'Env1', executionMode: 'Both', modelets: [{id: 'm1', name : 'MM1', status : 'active', capacity : '1 GB'}, {id: 'm2', name : 'MM2', status : 'active', capacity : '1 GB'}, {id: 'm3', name : 'MM3', status : 'active', capacity : '1 GB'}]}, {id: 2, poolName : 'Pool2', env : 'Env2', executionMode: 'Both', modelets: [{id: 'm4', name : 'MR1', status : 'active', capacity : '1 GB'}, {id: 'm5', name : 'MR2', status : 'active', capacity : '1 GB'}] } ]; and I have to drag and drop the modelet from one pool to another. for example, if I am dragging m3 from pool1 to and dropping it into modelets of pool2, then m3 should be removed from pool1.modelets and it should be added into pool2.modelets and vice-versa. Note : I am trying it using http://codef0rmer.github.io/angular-dragdrop/#/ Please provide me effective solution. Thanks in adnavce.
Finally, I got something which is working fine in this case ... We need to do below changes in draggable element. <div class="btn btn-primary" data-drag="true" data-jqyoui-options="{revert: 'invalid'}" ng-model="pool.modelets" jqyoui-draggable="{index: {{$index}},animate:true}" ng-hide="!modelet.name">{{modelet.name}}</div> updated fiddler is working fine.
WebDriver 2.45.0 & Firefox esr 31.5.0 :: WebDriverException: Unable to bind to locking port 7054 within 45000 ms
I'm testing selenium remote webdriver with grid and I got stuck with an error: org.openqa.selenium.WebDriverException: Unable to bind to locking port 7054 within 45000 ms Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:02:37' System info: host: 'XXXXX', ip: 'XXXXX', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_45' Driver info: driver.version: FirefoxDriver Command duration or timeout: 47.71 seconds Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:02:37' System info: host: 'XXXXX', ip: 'XXXXX', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_45' Driver info: org.openqa.selenium.remote.RemoteWebDriver Info about my configuration: selenium-server-standalone-2.45.0 browser: Firefox esr 31.5.0 I run tests with eclipe and testNG Hub configuration: { "host": null, "port": 4444, "newSessionWaitTimeout": -1, "servlets" : [], "prioritizer": null, "capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher", "throwOnCapabilityNotPresent": true, "nodePolling": 5000, "cleanUpCycle": 5000, "timeout": 300000, "browserTimeout": 0, "maxSession": 100, "jettyMaxThreads":-1 } I have three nodes with configuration like this: { "capabilities": [ { "browserName": "firefox", "maxInstances": 5, "seleniumProtocol": "WebDriver" }, { "browserName": "chrome", "maxInstances": 5, "seleniumProtocol": "WebDriver" }, { "browserName": "iexplorer", "maxInstances": 1, "seleniumProtocol": "WebDriver" } ], "configuration": { "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy", "maxSession": 10, "port": 5555, "host": ip, "register": true, "registerCycle": 5000, "hubPort": 4444, "hubHost": ip } } My question is: what could be the reasons for this error? For the moment I don't even understand why there is locking port 7054 even if my hub and nodes configuration ports are different. Thanks for your time and answers. UPDATE: #BeforeMethod and #AfterMethod functions #BeforeMethod public void setUp(){ StringBuilder text = customAppender.createInstance(); customAppender.setBuilder(text); WebDriver driver = LocalDriverFactory.createInstance("firefox"); LocalDriverManager.setWebDriver(driver); customAppender.append("Opened webDriver instance = " + driver.hashCode()); } #AfterMethod public void shutDown(){ WebDriver driver = LocalDriverManager.getDriver(); if (driver != null) { mainFunctions.log("Closed webDriver instance = " + driver.hashCode(), 2); driver.quit(); } } #Test methods: #Test(dataProvider = "getData") public static void test(String browserName, String link) throws MalformedURLException, InterruptedException { WebDriver driver = LocalDriverManager.getDriver(); customAppender.append("Thread id = " + Thread.currentThread().getId()); customAppender.append("Hashcode of webDriver instance = " + driver.hashCode()); driver.get(link); customAppender.append(driver.getTitle()); Thread.sleep(20000); // for testing purposes customAppender.append("Test 1, time: " + new SimpleDateFormat("HHmmss").format(Calendar.getInstance().getTime())); mainFunctions.log(customAppender.printOutString(), 0); } #Test(dataProvider = "getData") public static void test2(String browserName, String link) throws MalformedURLException, InterruptedException { WebDriver driver = LocalDriverManager.getDriver(); customAppender.append("Thread id = " + Thread.currentThread().getId()); customAppender.append("Hashcode of webDriver instance = " + driver.hashCode()); driver.get(link); customAppender.append(driver.getTitle()); Thread.sleep(20000); // for testing purposes customAppender.append("Test 2, time: " + new SimpleDateFormat("HHmmss").format(Calendar.getInstance().getTime())); mainFunctions.log(customAppender.printOutString(), 0); } #DataProvider #DataProvider(parallel=true) public Object[][] getData(){ Object[][] d = new Object[4][2]; // dummy data d[0][0] = "firefox"; d[0][1] = "http://www.google.com"; d[1][0] = "firefox"; d[1][1] = "http://www.google.com"; d[2][0] = "firefox"; d[2][1] = "http://www.google.com"; d[3][0] = "firefox"; d[3][1] = http://www.google.com"; return d; } testNG.xml file <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> <suite name="Suite" parallel="methods" thread-count="20"> <test name="Test"> <classes> <class name="ts.testWebdriver" /> </classes> </test> <!-- Test --> </suite> <!-- Suite -->
the cause might be that your firefox instance via webdriver is running on that particular port on remote machine. Kill the ff instance and execute the test. Do provide driver.quit() at end of your test case to avoid these failures.
Ok so I've had this issue with WebDriver, but couldn't fix it. Found a workaround though. I've created a new Windows user, and ran the tests from that user. Seems ok now. Good luck.