使用的框架是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>
错误:org.openqa.selenium.timeoutexception:等待位于以下位置的元素出现100秒后超时:by.xpath:*[@id='header division']生成信息:版本:'2.32.0',修订:'6C40C18',时间:'2013-04-09 17:23:22'系统信息:os.name:'Windows XP',os.arch:'x86',os.version:'5.1',java.version:'1.6.0_27'驱动程序信息:Driver.version:unknown at fluentWait.java:228)在junit.feature3stepdef.user_enters_and(feature3stepdef.java:53)在?。当用户输入“syahm”和“powerful4”(资源\feature\feature3.feature:5)导致:org.openqa.selenium.nosuchelementException:无法找到element with xpath==*[@id='header division'](警告:服务器没有提供任何stacktrace信息)命令持续时间或超时时间:343毫秒。有关此错误的文档,请访问ild信息:版本:'2.32.0',修订:'6C40C18',时间:'2013-04-09 17:23:22'系统信息:os.name:'Windows XP',os.arch:'x86',os.version:'5.1',java.version:'1.6.0_27'会话ID:bb4475ec-3408-43f3-a7d2-22e2c0b94b66驱动程序信息:org.openqa.selenium.ie.InternetExplorerDriver Capabilitions[{platform=windows,javascriptenabled=true,Esscreenshot=true,version=7}]
等待时间
Selenium只与DOM交互,所以我们不关心后面的代码。就呈现的html而言,这可能是一个时间问题。在调试模式下运行测试,并在测试开始时放置一个断点。然后,一旦页面有时间加载,就手动逐个执行每个步骤。
如果是时间问题,可以做两件事之一:
WebElement foundElement = new WebDriverWait(webdriver, 30).until(ExpectedConditions.visibilityOfElementLocated(By.Id("myId")));
根据以下指示进行更新 更新了来自reply的每个指令的webelemnt,然后下面是它在我的方法中实现的地方
问题内容: 我的网站上有一个选择控件。我正在使用页面对象与页面进行交互。如果我这样做(在我的课程下的前两行和我的方法中) 它以空指针失败。我也尝试了没有。 现在,如果我在我的方法中执行此操作,则一切正常,然后选择正确的项目 这是该控件的实际网页摘要(已编辑以保护无辜者) 让我说我可以解决我的问题, 但是 我不明白为什么“ 正常 ”路径无法正常工作。 问题答案: 那是因为该类具有以下构造函数: 见J
在版本2中,开发人员实现了新字段,如何通过运行库本身动态获取新字段的web元素,而不需要手动派生XPath?
image元素 alt属性,src属性 complete属性 height属性,width属性 naturalWidth属性,naturalHeight属性 audio元素,video元素 image元素 alt属性,src属性 alt属性返回image元素的HTML标签的alt属性值,src属性返回image元素的HTML标签的src属性值。 // 方法一:HTML5构造函数Image var
image元素 alt属性,src属性 complete属性 height属性,width属性 naturalWidth属性,naturalHeight属性 audio元素,video元素 image元素 alt属性,src属性 alt属性返回image元素的HTML标签的alt属性值,src属性返回image元素的HTML标签的src属性值。 // 方法一:HTML5构造函数Image var
我试着从这一页中刮出博彩赔率: https://www.interwetten.com/en/sportsbook/top-leagues?toplinkid=1 现在我得到的输出是: 现在我想提取每个中的团队名,但我不知道如何提取。我尝试使用节点或attrs,但没有效果。