I am using IBM JSF 1.2.
This is snippet of main jsp page:
<hx:panelBox rendered="#{pc_DispositionDOTVC.forEdit.type ne pc_DispositionDOTVC.VIEW}">
<h:outputLabel styleClass="outputLabel" for="selectCargoWarehouse" value="#{msg.lblWarehouse}" />
<h:selectOneMenu id="selectCargoWarehouse" styleClass="selectOneMenu" required="true"
value="#{pc_DispositionDOTVC.forEditCargo.cargo.warehouse.warehouseName}">
<f:selectItems value="#{selectItemsFactory.warehousesByCompanyTerminalSpecial}" />
</h:selectOneMenu>
<h:message styleClass="message" for="selectCargoWarehouse" />
<hx:commandExButton type="submit" styleClass="commandExButton" value="#{msg.buttonAttachNewCargo}" id="cargoButtonAdd">
<hx:behavior event="onclick" behaviorAction="get;show" onActionFunction="openDialog()" id="cargoBehaviorAdd"
targetAction="addCargoDialog;addCargoDialog" /></hx:panelBox>
<hx:panelBox id="helpBox2">
<hx:ajaxRefreshSubmit id="ajaxRefreshSubmitCargo" target="helpBox2" />
</hx:panelBox> <%-- insert new cargo --%>
<jsp:include page="addCargoFromWarehouseDialog.jsp" />
And this is dialog jsp page (addCargoFromWarehouseDialog.jsp):
<%#page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%#taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%#taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%#taglib uri="http://www.ibm.com/jsf/html_extended" prefix="hx"%>
<%-- insert new cargo --%>
<hx:panelDialog type="modal" id="addCargoDialog" styleClass="panelDialog" showTitleCloseButton="false"
onshow="openDialog()" onhide="closeDialog()" noKeybindings="true" title="#{msg.buttonAttachNewCargo}">
<h:panelGroup style="display:block; height:400px; overflow-y:scroll; overflow-x:hidden;" >
<h:panelGrid id="addCargoGrid1" styleClass="panelGrid">
<h:outputText id="cargoText01" styleClass="outputText" value="#{pc_DispositionEditCargoDialog.incomingCargosByWarehouseNameAndCargoCompany}"></h:outputText>
<hx:dataTableEx border="0" cellpadding="2" cellspacing="0" columnClasses="columnClass" headerClass="headerClass"
footerClass="footerClass" rowClasses="rowClass1, rowClass2" id="addCargoTable1"
rendered="#{!empty pc_DispositionEditCargoDialog.incomingCargosByWarehouseNameAndCargoCompany}"
value="#{pc_DispositionEditCargoDialog.incomingCargosByWarehouseNameAndCargoCompany}"
styleClass="dataTableEx2" var="freeCargo">
<hx:columnEx id="cargoColumnEx1">
<f:facet name="header">
<h:outputText id="cargoText01" styleClass="outputText" value="#{msg.lblCargoId}"></h:outputText>
</f:facet>
<h:outputText id="cargoDynText01" styleClass="outputText" value="#{freeCargo.cargoId}"></h:outputText>
</hx:columnEx>
<hx:columnEx id="cargoColumnEx41">
<f:facet name="header">
<h:outputText id="cargoText041" styleClass="outputText" value="#{msg.lblDispositionWeightOfGoods}"></h:outputText>
</f:facet>
<h:outputText id="cargoDynText041" styleClass="outputText" value="#{freeCargo.availableWeightOfGoods}">
<hx:convertNumber maxFractionDigits="2" type="number" pattern="#,###,###,###,##0.00" />
</h:outputText>
</hx:columnEx>
<hx:columnEx id="cargoColumnEx5">
<f:facet name="header">
</f:facet>
<h:panelGroup id="addCargoGroup1" styleClass="buttonGroup">
<h:commandLink id="saveCargoLink1" immediate="true" styleClass="positive"
action="#{pc_DispositionEditCargoDialog.addDispositionCargo}" value="#{msg.buttonAddCargo}">
<f:param id="paramCargoId" name="cargoId" value="#{freeCargo.cargoId}"/>
</h:commandLink>
</h:panelGroup>
</hx:columnEx>
</hx:dataTableEx>
</h:panelGrid>
</h:panelGroup>
<h:panelGroup id="addCargoGroup2" styleClass="buttonGroup">
<hx:commandExButton id="buttonCancelCargoAdd" immediate="true" styleClass="negative" value="#{msg.buttonCancel}"
action="#{pc_DispositionEditCargoDialog.clearCargos}" type="submit">
<hx:behavior event="onclick" behaviorAction="get;hide"
id="cargoBehavior2"
targetAction="subview1:panelForm:helpBox2;subview1:panelForm:addCargoDialog">
</hx:behavior>
</hx:commandExButton>
</h:panelGroup>
</hx:panelDialog>
<hx:ajaxRefreshSubmit id="ajaxRefreshSubmitCargo2" target="addCargoDialog" />
<%-- / insert new cargo --%>
I have a combobox to select warehouse and button to open dialog and select cargo from cargo list of available cargos from the warehouse.
When I select warehouse which has cargos and select add cargo button, the list of cargos appear.
When I select warehouse, which has no cargos, it opens an empty dialog (which is ok). But selecting the warehouse, which has cargo, again, I get en empty list(which is not ok). If I click browser refresh button than list of cargos appears normally.
This only happens in Mozilla Firefox and Chrome, in IE 11 it works fine.
It seems to me that jsf ajaxRefreshSubmit is not working properly.
Please take a look, any kind of help is very much appreciated.
Thanks in advance,
mismas
[EDIT1]:
There is nothing abnormal in the web console or firebug (when I click F12)
This is the response which I get in both cases (200 POST http://localhost:8080/ExtComConWeb/pages/secure/disposition/dispositionDOTVC.faces?%24%24ajaxid=subview1%3ApanelForm%3AaddCargoDialog&%24%24ajaxmode=axfull):
<div id="subview1:panelForm:addCargoDialog" class="panelDialog" style="position:absolute; display:none;"><div id="subview1:panelForm:addCargoDialog_tb" title="Dodaj teret">Dodaj teret</div><div id="subview1:panelForm:addCargoDialog_ca"><span style="display:block; height:400px; overflow-y:scroll; overflow-x:hidden;"> <table id="subview1:panelForm:addCargoGrid1" class="panelGrid">
<tbody>
<tr>
<td><span id="subview1:panelForm:cargoText01" class="outputText"> [hr.combis.comcon.persistency.hibernate.impl.crg.Cargo#58996c54, hr.combis.comcon.persistency.hibernate.impl.crg.Cargo#2468c3d]</span></td>
</tr>
<tr>
<td><table id="subview1:panelForm:addCargoTable1" class="dataTableEx2" border="0" cellpadding="2" cellspacing="0" ><thead ><tr ><th class="headerClass" scope="col" ><span id="subview1:panelForm:addCargoTable1:cargoText01" class="outputText">Broj tereta</span></th><th class="headerClass" scope="col" ><span class="outputText">K447</span></th><th class="headerClass" scope="col" ><span class="outputText">JCD</span></th><th class="headerClass" scope="col" ><span class="outputText">MRN</span></th><th class="headerClass" scope="col" ><span id="subview1:panelForm:addCargoTable1:cargoText02" class="outputText">Standardni opis tereta</span></th><th class="headerClass" scope="col" ><span id="subview1:panelForm:addCargoTable1:cargoText031" class="outputText">Br.ul. disp.</span></th><th class="headerClass" scope="col" ><span id="subview1:panelForm:addCargoTable1:cargoText03" class="outputText">Tip pakiranja</span></th><th class="headerClass" scope="col" ><span id="subview1:panelForm:addCargoTable1:cargoText04" class="outputText">Tip mjere</span></th><th class="headerClass" scope="col" ><span id="subview1:panelForm:addCargoTable1:cargoText041" class="outputText">Težina robe</span></th><th class="headerClass" scope="col" ><span id="subview1:panelForm:addCargoTable1:cargoText042" class="outputText">Volumen</span></th><th class="headerClass" scope="col" ><span id="subview1:panelForm:addCargoTable1:cargoText043" class="outputText">Komada</span></th><th class="headerClass" scope="col" ><img src="/ExtComConWeb/.ibmjsfres/img/1x1.gif" ></img></th></tr>
</thead><tbody >
<tr class="rowClass1" ><td class="columnClass" ><span id="subview1:panelForm:addCargoTable1:0:cargoDynText01" class="outputText">72369</span></td>
<td class="columnClass" ><span class="outputText"></span></td>
<td class="columnClass" ><span class="outputText"></span></td>
<td class="columnClass" ><span class="outputText"></span></td>
<td class="columnClass" ><span id="subview1:panelForm:addCargoTable1:0:cargoDynText02" class="outputText">Antracit</span></td>
<td class="columnClass" ><span id="subview1:panelForm:addCargoTable1:0:cargoDynText031" class="outputText">00007/06/2015</span></td>
<td class="columnClass" ><span id="subview1:panelForm:addCargoTable1:0:cargoDynText03" class="outputText">Nepakirani</span></td>
<td class="columnClass" ><span id="subview1:panelForm:addCargoTable1:0:cargoDynText04" class="outputText">Mjeren po volumenu</span></td>
<td class="columnClass" ><span id="subview1:panelForm:addCargoTable1:0:cargoDynText041" class="outputText">121,00</span></td>
<td class="columnClass" ><span id="subview1:panelForm:addCargoTable1:0:cargoDynText042" class="outputText">1.465,000</span></td>
<td class="columnClass" ><span id="subview1:panelForm:addCargoTable1:0:cargoDynText043" class="outputText">12</span></td>
<td class="columnClass" ><span id="subview1:panelForm:addCargoTable1:0:addCargoGroup1" class="buttonGroup"><a id="subview1:panelForm:addCargoTable1:0:saveCargoLink1" href="#" onclick="if(typeof jsfcljs == 'function') {jsfcljs(document.getElementById('subview1:panelForm'),{'subview1:panelForm:addCargoTable1:0:saveCargoLink1':'subview1:panelForm:addCargoTable1:0:saveCargoLink1','cargoId':'72369'},'');}return false" class="positive">Dodaj teret</a></span></td>
</tr>
<tr class="rowClass2" ><td class="columnClass" ><span id="subview1:panelForm:addCargoTable1:1:cargoDynText01" class="outputText">72454</span></td>
<td class="columnClass" ><span class="outputText"></span></td>
<td class="columnClass" ><span class="outputText"></span></td>
<td class="columnClass" ><span class="outputText"></span></td>
<td class="columnClass" ><span id="subview1:panelForm:addCargoTable1:1:cargoDynText02" class="outputText">Banane</span></td>
<td class="columnClass" ><span id="subview1:panelForm:addCargoTable1:1:cargoDynText031" class="outputText">00014/06/2015</span></td>
<td class="columnClass" ><span id="subview1:panelForm:addCargoTable1:1:cargoDynText03" class="outputText">Palete</span></td>
<td class="columnClass" ><span id="subview1:panelForm:addCargoTable1:1:cargoDynText04" class="outputText">Mjeren na komade</span></td>
<td class="columnClass" ><span id="subview1:panelForm:addCargoTable1:1:cargoDynText041" class="outputText">1.213,00</span></td>
<td class="columnClass" ><span id="subview1:panelForm:addCargoTable1:1:cargoDynText042" class="outputText">121,000</span></td>
<td class="columnClass" ><span id="subview1:panelForm:addCargoTable1:1:cargoDynText043" class="outputText">12</span></td>
<td class="columnClass" ><span id="subview1:panelForm:addCargoTable1:1:addCargoGroup1" class="buttonGroup"><a id="subview1:panelForm:addCargoTable1:1:saveCargoLink1" href="#" onclick="if(typeof jsfcljs == 'function') {jsfcljs(document.getElementById('subview1:panelForm'), {'subview1:panelForm:addCargoTable1:1:saveCargoLink1':'subview1:panelForm:add CargoTable1:1:saveCargoLink1','cargoId':'72454'},'');}return false" class="positive">Dodaj teret</a></span></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</span><span id="subview1:panelForm:addCargoGroup2" class="buttonGroup"> <input type="submit" value="Odustani" id="subview1:panelForm:buttonCancelCargoAdd" name="subview1:panelForm:buttonCancelCargoAdd" class="negative" /></span> </div></div><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="j_id103:j_id105" /><script type="text/javascript">
hX_6.addComponent("subview1:panelForm:addCargoDialog", new hX_6.JSFDialog("no-keybindings:true", "onshow:openDialog()", "onhide:closeDialog()"));
hX_6.addBehavior("subview1:panelForm:buttonCancelCargoAdd", "onclick", new hX_6.JSFBehaviorGeneric("action:get;hide", "target:subview1:panelForm:helpBox2;subview1:panelForm:addCargoDialog"));
if(hX_6.getBehaviorById("subview1:panelForm:addCargoDialog", "ajaxsubmit", "onget"))hX_6.getBehaviorById("subview1:panelForm:addCargoDialog", "ajaxsubmit", "onget").setAttribute("href:/ExtComConWeb/pages/secure /disposition /dispositionDOTVC.faces?$$ajaxid=subview1:panelForm:addCargoDialog&$$ajaxmode =axfull");
</script>
The difference is that in case of selecting the cargos for the warehouse, after the one that is empty, I don't get rendered the result table ...
In other case, when first selecting warehouse which has cargos, it works fine ... I can't see the difference which would cause cargo list not rendering ...
Please help ...
[EDIT2]
Also I have noticed when printing pc_DispositionEditCargoDialog.incomingCargosByWarehouseNameAndCargoCompany list:
<h:outputText id="cargoText01" styleClass="outputText" value="# {pc_DispositionEditCargoDialog.incomingCargosByWarehouseNameAndCargoCompany}" ></h:outputText>
I get:
when warehouse has cargos: [hr.combis.comcon.persistency.hibernate.impl.crg.Cargo#71b78ef4, hr.combis.comcon.persistency.hibernate.impl.crg.Cargo#517ce92d]
[] when warehouse has cargos, but is clicked after warehouse that has no cargos. It's strange, because response has cargo list and I chceked server side function getIncomingCargosByWarehouseNameAndCargoCompany which also returnes not empty list. I can't see why this list is not rendering ...
[EDIT3]
I have noticed that when helpBox2 is removed from addCargoFromWarehouseDialog.jsp, then table of cargos renders normally in the dialog.
This is changed piece of code from addCargoFromWarehouseDialog.jsp (removed helpBox2 item):
<h:panelGroup id="addCargoGroup2" styleClass="buttonGroup">
<hx:commandExButton id="buttonCancelCargoAdd" immediate="true" styleClass="negative" value="#{msg.buttonCancel}"
action="#{pc_DispositionEditCargoDialog.clearCargos}" type="submit">
<hx:behavior event="onclick" behaviorAction="hide"
id="cargoBehavior2"
targetAction="subview1:panelForm:addCargoDialog">
</hx:behavior>
</hx:commandExButton>
But now, after I click Cancel button I get the whole page reloaded. Before, when helpBox2 was used, clicking Cancel button would do one more POST with ajax, so the hole page wasn't reloaded again.
Can anybody advise how to accomplish this affect without having to use this helpBox2 trick? Or how to change it in order not to interfering with cargos table rendering?
This is the response of that additional POST with ajax:
<table id="subview1:panelForm:helpBox2"><tr><td></td></tr></table> <input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="j_id104:j_id120" /><script type="text/javascript">
if(hX_6.getBehaviorById("subview1:panelForm:helpBox2", "ajaxsubmit", "onget"))hX_6.getBehaviorById("subview1:panelForm:helpBox2", "ajaxsubmit", "onget").setAttribute("href:/ExtComConWeb/pages/secure/disposition /dispositionDOTVC.faces?$$ajaxid=subview1:panelForm:helpBox2&$$ajaxmode=axfull");
</script>
Also I have noticed this is acting really strange.
If I do first empty warehouse - works, then full - works.
But full - works, empty - works, full - doesn't work.
I don't get it, what is a trick here?
Please help. Thanks!
Related
Trying to select and click multiple checkboxes on a page. they don't have a class, ID or names that match. All they have in common is their input type (checkbox). I'm able to select individual checkboxes using XPATH but its not practical as there's at least 100 checkboxes on the page.
Here's a section of the HTML. I've been testing this code on an off-line version of the site.
<body>
<tbody>
<tr>
<td class="borderBot"><b>Activity</b></td>
<td class="borderBot">
<table cellpadding="3" cellspacing="3" width="100%">
<tbody>
<tr>
<td width="33%">
<input type="checkbox" name="competency1Activity" value="1" />
Plan (ie Interpreted diag etc)
</td>
<td width="33%">
<input type="checkbox" name="competency1Activity" value="2" />
Carry Out (ie conducted work)
</td>
<td width="33%">
<input type="checkbox" name="competency1Activity" value="4" />
Complete (ie Compliance etc)
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="borderBot"><b>Supervision</b></td>
<td class="borderBot">
<table cellpadding="3" cellspacing="3" width="100%">
<tbody>
<tr>
<td width="33%">
<input
type="checkbox"
name="competency1Supervision"
value="1"
/>
Direct
</td>
<td width="33%">
<input
type="checkbox"
name="competency1Supervision"
value="2"
/>
General
</td>
<td width="33%">
<input
type="checkbox"
name="competency1Supervision"
value="4"
/>
Broad
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="borderBot"><b>Support</b></td>
<td class="borderBot">
<table cellpadding="3" cellspacing="3" width="100%">
<tbody>
<tr>
<td width="33%">
<input type="checkbox" name="competency1Support" value="1" />
Constant
</td>
<td width="33%">
<input type="checkbox" name="competency1Support" value="2" />
Intermittent
</td>
<td width="33%">
<input type="checkbox" name="competency1Support" value="4" />
Minimal
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="borderBot"><b>Materials</b></td>
<td class="borderBot">
<table cellpadding="3" cellspacing="3" width="100%">
<tbody>
<tr>
<td width="50%">
<input type="checkbox" name="competency1Extended" value="1" />
Insulation failure
</td>
<td width="50%">
<input type="checkbox" name="competency1Extended" value="2" />
Incorrect connections
</td>
</tr>
<tr>
<td width="50%">
<input type="checkbox" name="competency1Extended" value="4" />
Circuits-wiring; eg. open short
</td>
<td width="50%">
<input type="checkbox" name="competency1Extended" value="8" />
Unsafe condition
</td>
</tr>
<tr>
<td width="50%">
<input
type="checkbox"
name="competency1Extended"
value="16"
/>
Apparatus/component failure
</td>
<td width="50%">
<input
type="checkbox"
name="competency1Extended"
value="32"
/>
Related mechanical failure
</td>
</tr>
<tr>
<td width="50%">
<input
type="checkbox"
name="competency1Extended"
value="64"
/>
Read/interpret drawings/plans
</td>
<td width="50%">
<input
type="checkbox"
name="competency1Extended"
value="128"
/>
Other elec app and circuit faults
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<input
type="hidden"
id="competency1ExtendedCount"
name="competency1ExtendedCount"
value="8"
/>
</tbody>
</body>
Try 1 - this selects and clicks the first checkbox but none of the others
checkboxes = driver.find_element(By.CSS_SELECTOR, "input[type='checkbox']").click()
Try 2 - Thought this would work but I cant get the syntax right
checkboxes = driver.find_element(By.CSS_SELECTOR, "input[type='checkbox']")
for checkbox in checkboxes:
checkboxes.click()
time.sleep(.3)
Try 3 - able to select first checkbox (of 3) with this name
checkboxes = driver.find_element("name", "competency1Ativity").click()
find_element() will return only the first matching element, where as you need to identify all of them. So you need to use find_elements() method.
Solution
You can identify all the checkbox and store the elements within a list and then click on them one by one using either of the following locator strategies:
Using CSS_SELECTOR:
from selenium.webdriver.common.by import By
checkboxes = driver.find_elements(By.CSS_SELECTOR, "td input[type='checkbox']")
for checkbox in checkboxes:
checkbox.click()
Using XPATH:
from selenium.webdriver.common.by import By
checkboxes = driver.find_elements(By.XPATH, "//td//input[#type='checkbox']")
for checkbox in checkboxes:
checkbox.click()
Your option 2 was nearly correct, however it should have been find_elements() not find_element()
Since find_element() just returns an webelement where as find_elements() returns list of elements.
code:
checkboxes = driver.find_elements(By.CSS_SELECTOR, "input[type='checkbox']")
for checkbox in checkboxes:
checkbox.click()
time.sleep(0.5)
I am using a bootstrap carousel to pass the tables (these are generated from the db), I tried to use the prime-faces poll but it only recharges me once and after that the first table remains static and loses transition effect . Any recommendation...
psdta: Primefaces 4.0, and bootstrap 4 are part of the design.
<h:form id="tablas">
<p:ajaxStatus onstart="statusDialog.show();" onsuccess="statusDialog.hide();"/>
<p:dialog modal="true" widgetVar="statusDialog" resizable="false" draggable="false" closable="false"
showHeader="false" style="border: none; opacity: 0.75;">
<p:graphicImage id="refreshTable" value="./../resources/images/cargandoLogin.gif" style="width: 100px; height: 100px; " />
</p:dialog>
<div id="carouselExampleInterval" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="limiter">
<div class="container-table100">
<h:outputText value="#{beansSeguimientoRelease.dateTable}" escape="false"/>
<div class="carousel-item" data-interval="#{beansSeguimientoRelease.contTabla}">
<div id="main-container">
<div class="tituloN">NOTAS</div>
<table class="table table-bordered" style="text-orientation: upright;">
<thead>
<tr>
<th scope="col" style="background-color: #0f7ff4">TEMAS PENDIENTES</th>
<th scope="col" style="background-color: #0f7ff4">NOTAS</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left; border-left: 15px black !important;">
<h:outputText value="#{beansSeguimientoRelease.itemNotas.tareas}" escape="false"/> </td>
<td style="text-align: left;">
<h:outputText value="#{beansSeguimientoRelease.itemNotas.notas}" escape="false"/></td>
</tr>
<tr>
<td style="text-align: right;">Disponibilidad:</td>
<td><h:outputText value= "#{beansSeguimientoRelease.itemNotas.disponibilidad}" escape="false"/></td>
</tr>
<tr>
<td style="text-align: right;">Operador Noc:</td>
<td><h:outputText value="#{beansSeguimientoRelease.itemNotas.operador_noc}" escape="false"/> </td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<a id="aPrev" class="carousel-control-prev" href="#carouselExampleInterval" role="button" data-slide="prev" style="width: 5%">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a id="aNext" class="carousel-control-next" href="#carouselExampleInterval" role="button" data-slide="next" style="width: 5%">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
<p:poll id="Tpoll" interval="#{beansSeguimientoRelease.cont}" update="tablas"/>
</h:form>
I assume that problem is caused by fact that p:poll is inside h:form and that, by updating entire form, it updates itself too and stops working (maybe you can see something in JS debug console).
Try to wrap up carousel div into h:panelGroup like this
<h:panelGroup id="wrapper" layout="block">
<div id="carouselExampleInterval" class="carousel slide"...>
...
</div>
</h:panelGroup>
and then, when poll interval expires, update only newly added h:panelGroup
<p:poll id="Tpoll" interval="#{beansSeguimientoRelease.cont}" update=":tablas:wrapper"/>
I use selenium webdriver with node js.
I cannot get the text from this site. I need the "In progress" text.
I don't want to use absolute xpath, because I want use the code in other tests.
Thank you. :)
<div class="issuePanelContainer" id="issue_actions_container"
style="height: auto;">
<table cellpadding="0" cellspacing="0" border="0" width="100%"> .
</table>
<div class="issue-data-block">
<div class="actionContainer">
<div class="action-details">
<span class="aui-avatar aui-avatar-xsmall">
<span class="aui-avatar-inner">
<img alt="" src="https://jira.au.flitech.net/secure/useravatar?size=xsmall&ownerId=jan.plzak%40flightcentre.co.uk&avatarId=12582">
</span>
</span>
<a class="user-hover" rel="jan.plzak#flightcentre.co.uk" id="email_jan.plzak#flightcentre.co.uk" href="/secure/ViewProfile.jspa?name=jan.plzak%40flightcentre.co.uk">Jan Plzak</a>
made transition
- <span class="date" title="18/Jun/19 4:57 PM"><time class="livestamp" datetime="2019-06-18T16:57:08+1000">18/Jun/19 4:57 PM</time></span>
</div>
<div class="changehistory action-body">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tbody><tr>
<td width="60%">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tbody><tr>
<td width="47%" align="right">
<span class=" jira-issue-status-lozenge aui-lozenge jira-issue-status-lozenge-blue-gray jira-issue-status-lozenge-new jira-issue-status-lozenge-max-width-medium" data-tooltip="<span class="jira-issue-status-tooltip-title">Open</span>" title="" original-title="">Open</span> </td>
<td align="center" nowrap="nowrap" width="6%">
<img src="/images/icons/arrow_right_small.gif" align="absmiddle" border="0" height="16" width="16">
</td>
<td width="47%">
<span class=" jira-issue-status-lozenge aui-lozenge jira-issue-status-lozenge-yellow jira-issue-status-lozenge-indeterminate jira-issue-status-lozenge-max-width-medium" data-tooltip="<span class="jira-issue-status-tooltip-title">In Progress</span><br><span class="jira-issue-status-tooltip-desc">The development task is currently in progress</span>" title="" original-title="">In Progress</span></td>
</tr>
</tbody></table>
</td>
<td width="20%">
13d 21h 18m
</td>
<td width="20%" align="center">
1
</td>
</tr>
</tbody></table>
</div>
List<WebElement> list=driver.findElement(By.xpath("//span[contains(#class,'status')]"));
for(WebElement li:list)
{
if(li.getText().equals("In progress")
{
li.click(); // or assert or whatever
}
}
This is my answer, which is working fine, and content free. :)
driver.findElements(By.xpath('//div[#class="changehistory action-body"]/table/tbody/tr/td/table/tbody/tr/td[1]/span'));
Referring to this previous question:
How to access the attribute value of soap UI response XML
I need this script to be dynamic, be able each test run to send a different XML body to parse.
How can this be achieved?
Sample XML
</script>
<form onsubmit="submitAction();return false;" name="submitForm" method="post" action="auth_vbv_browser_authentication.xsl">
<input value="auth_vbv_browser_authentication.xsl" type="hidden" name="AA_CurrentPage"/>
<input value="false" type="hidden" name="TDS_DeviceAuthentication"/>
<input value="0" type="hidden" name="mobileCount"/>
<table width="390" height="400" cellspacing="0" cellpadding="1" bgcolor="#e8e8e8" align="center">
<tr>
<td valign="top">
<table width="100%" style="padding:20px;" height="100%" cellspacing="0" cellpadding="0" border="0" bgcolor="#ffffff">
<tr>
<td valign="top" height="1">
<img width="140" src="../580655198662148898/auth_issuer_logo_vbv.gif" height="47" border="0" align="left"/>
<img width="89" src="../580655198662148898/auth_vbv_lg.gif" height="51" border="0" align="right"/>
</td>
</tr>
<tr>
<td height="20"/>
</tr>
<tr>
<td height="1" colspan="3" align="right">
<font size="-2">
<span style="display:none" name="links">
<a onclick="return openDialog(2,1)" id="langLink_sec" href="#">???</a>
<a style="display:none" id="lang_link_sec">???</a>
English
</span>
<noscript>
???
English
</noscript>
</font>
</td>
</tr>
<tr>
<td valign="top" height="1">
<font class="auth_Heading_en">Enter Your Authentication Data</font>
</td>
</tr>
<tr>
<td height="1"/>
</tr>
<tr>
<td valign="top" height="1">
<font class="auth_TxtMain_en">Please enter your</font>
<font class="auth_TxtMain_en">Verified by VISA Password</font>
<font class="auth_TxtMain_en">in the field(s) below to verify your identity for this purchase. This information is not disclosed to the merchant.</font>
</td>
</tr>
<tr>
(part of it very long):
I need to get out from this the value of SSID (1710d5e8428fd9d53db2fe7cfb1c79a5af0ecce).
Tried:
def xml = context.response
def holder = new com.eviware.soapui.support.XmlHolder(xml)
//use the xpath to retrieve the desctiption.
def ParRes = holder.getNodeValues("//*:input/#value")
//logging the descriptions
def str = new StringBuilder();
ParRes.each{
if("$it" != "InitAuth" ){
str = "$it"
}
}
return str
It is easy to handle dynamic response and parse it if Script Assertion is used for the same request step where you get the response. Thus an additional groovy script step can be avoided.
All the changed required is to change 1st statement from
def xml = """
static xml content
"""
to
def xml = context.response
And rest of the solution pointed in your question remains same.
As you have not provided complete response so I took only the form tag:
<form onsubmit="submitAction();return false;" name="submitForm" method="post" action="auth_vbv_browser_authentication.xsl">
<input value="auth_vbv_browser_authentication.xsl" type="hidden" name="AA_CurrentPage"/>
<input value="false" type="hidden" name="TDS_DeviceAuthentication"/>
<input value="0" type="hidden" name="mobileCount"/>
<table width="390" height="400" cellspacing="0" cellpadding="1" bgcolor="#e8e8e8" align="center">
<tr>
<td valign="top">
<table width="100%" style="padding:20px;" height="100%" cellspacing="0" cellpadding="0" border="0" bgcolor="#ffffff">
<tr>
<td valign="top" height="1">
<img width="140" src="../580655198662148898/auth_issuer_logo_vbv.gif" height="47" border="0" align="left"/>
<img width="89" src="../580655198662148898/auth_vbv_lg.gif" height="51" border="0" align="right"/>
</td>
</tr>
<tr>
<td height="20"/>
</tr>
<tr>
<td height="1" colspan="3" align="right">
<font size="-2">
<span style="display:none" name="links">
<a onclick="return openDialog(2,1)" id="langLink_sec" href="#">???</a>
<a style="display:none" id="lang_link_sec">???</a>
English
</span>
<noscript>
???
English
</noscript>
</font>
</td>
</tr>
<tr>
<td valign="top" height="1">
<font class="auth_Heading_en">Enter Your Authentication Data</font>
</td>
</tr>
<tr>
<td height="1"/>
</tr>
<tr>
<td valign="top" height="1">
<font class="auth_TxtMain_en">Please enter your</font>
<font class="auth_TxtMain_en">Verified by VISA Password</font>
<font class="auth_TxtMain_en">in the field(s) below to verify your identity for this purchase. This information is not disclosed to the merchant.</font>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
As per my understanding you want the Value of SSID i.e1710d5e8428fd9d53db2fe7cfb1c79a5af0ecce
and you want to transfer this in next step,so why dont you use Property transfer step and provide Xpath as below:
substring-before(substring-after(/form[#onsubmit="submitAction();return false;"]/table[#width="390"]/tr/td[#valign="top"]/table[#width="100%"]/tr[3]/td[#height="1"]/font[#size="-2"]/noscript/a[#href="auth_vbv_browser_authentication.xsl?AA_CurrentPage=auth_vbv_browser_authentication.xsl&AA_Ignore_Pattern=true&AA_LANCODE=1&SSID=1710d5e8428fd9d53db2fe7cfb1c79a5af0ecce&popup=false"]/#href,"SSID="),"&")
result of this Xpath:1710d5e8428fd9d53db2fe7cfb1c79a5af0ecce
I have tested it on my SOAPUI and working fine.Hope this helps
Note: I have copied Xpath from Form tag,Please change the Xpath as per your requirement,you can use online tools to calulate Xpath or any XML editor.
For more info on Xpath :Check this out
<tr class="even_row">
<td colspan="1" rowspan="1">
<button type="button" onclick="doSubmit('_eventId_addToHouseholdFromOther')">
<span>
<i class="icon-arrow-left"></i>
</span>
</button>
</td>
<td colspan="1" rowspan="1"> … </td>
<td colspan="1" rowspan="1"> … </td>
<td colspan="1" rowspan="1"> … </td>
</tr>
Does anybody know, how I can click on this button using watir webdriver?
Assuming that the <i class="icon-arrow-left"> element is unique (ie no other i element with the same class exists), you can do:
browser.i(:class => 'icon-arrow-left').click