I have a jsp with multiple divs and another jsp with links to these divs. I would like to invoke a specific div on the click of a link.
First JSP
<html>
<li>
What is 'porting'?
</li>
</html>
legals.jsp(Second jsp)
<div id="tab-01" class="ta-body" role="tabpanel" tabindex="0">
<h4>What is 'porting'?</h4>
<p>
Porting is....
</p>
</div>
In the First JSP, change href="legals.jsp"attribute to this:
href="legals.jsp#tab-01"
Related
In jsp div's are in below order
<div id="identification"/>
<div id="address"/>
<div id="communication"/>
<div id="familyDetail"/>
but while rendering in JBOSS and Weblogic server below is HTML output
<div id="address"/>
<div id="communication"/>
<div id="identification"/>
<div id="familyDetail"/>
Jsp java file also in same order as in jsp but while converting in HTML it gets changed
So i have FormControl inside Repeating View and i set html for Repeating view as Wicket:container
I am trying to refresh formControl but because i am stripping wicket tags in output
it gives JS error.
i know wicket:container can not be refreshed. but i am not able to refresh control inside it. I tried setting
control.setOutputMarkupPlaceholderTag(true);
control.setOutputMarkupId(true);
And Html is Something like this
<form wicket:id="form">
<wicket:container wicket:id="repeatingContainer">
</wicket:container>
</form>
here is error i am getting
Cannot bind a listener for event "change" on element "id1a3" because the element is not in the DOM
i want to remove repeatingContainer html tag from output so it follows bootstrap form layout.
Update:
This code is inside the RepeaterView
<wicket:panel>
<div wicket:id="componentGroup">
<wicket:child/>
</div>
</wicket:panel>
This code wicket Child
<div wicket:id="labelContainer">
<label wicket:id="label"></label>
</div>
<div wicket:id="controlContainer" class="control-container">
<input wicket:id="input"/>
</div>
ok so i am able to tackle this down.
I updated component Group div to wicket:container and leave the Repeater as div. So now i am able to refresh. and it works alright.
So this is how it will look like
<form wicket:id="form">
<div wicket:id="repeatingContainer">
<wicket:container wicket:id="componentGroup">
<div wicket:id="labelContainer">
<label wicket:id="label"></label>
</div>
<div wicket:id="controlContainer" class="control-container">
<input wicket:id="input"/>
</div>
</wicket:container>
</div>
</form>
In my selenium automation script, I am trying to click a "Policy" tab in the webpage by its xpath value.
Here is the actual html code:
....
<iframe src="/abc/api/public/v1/security/redirect">
#document
<!DOCTYPE html>
<html class="ng-scope" ng-app="CFWApp" lang="en">
<body>
<div class="container no-padding main-view flex-col">
::before
<cfw-menu class="ng-isolate-scope">
<div class="security-menu">
<ul class = "flex-row">
<li class="tab ng-scope active" ng-repeat="tab in $ctrl.items" ng-class="{'active': $ctrl.active == $index}" ui-sref="policy.templateList" href="#!/policy/template" style="">
<span class="tab-icon">...</span>
<span class='ng-binding'>Policy</span>
</li>
<li> ... </li>
</ul>
</div>
</cfw-menu>
...
</div>
</body>
</html>
And here is my Java code:
driver.findElement(By.xpath("//li[starts-with(#class = 'tab') and contains(#ui-sref = 'policy.templateList')]/span[2]")).click();
But somehow, this xpath setting not working. Can someone help me for that ? Thanks a lot !
For start you need to move to iframe
WebElement iframe = driver.findElement(By.xpath("..."));
driver.switchTo().frame(popframe);
After, you can use
driver.findElement(By.xpath("//span[text() = 'Policy']")).click();
But you need to be sure is not more spans which have text 'Policy' in that frame.
policy.templateList')]/span[2]")).click()
It will not work as you are trying to click a span element not the button.
Once I also trapped in such type of problem in python and then I use action class in selenium
First of all select any thing then by selenium action class pass tab key untill you get that element focused then pass enter key using action class that's it.
Good luck...
I have a jsp page like this
<c:forEach var="product" items="${products}" >
<div class="col-md-3">
<div class="panel-body">
<div>
<a href="description.html">
<div class="thumbnail">
<img src="data:image/jpeg;base64,${product.base64EncodedImage}" alt="image">
<div class="caption" align="center">
<p>
<h4>${product.name}</h4>
<h5>cost:Rs ${product.price}/-</h5>
i fetch the productimage,price,name using for each.from for each in jsp i have to get parameter values in servlet using request.getParameter() and have to implement in another page using those parameters
I have a tumbnails in page.when we click on it it redirects into another page.there we have to set particular tumnails image,product name,price
help me how to get that parameters in servlet class
please check image in this link--->>
I have to get the Product name,product price, image from 1 tumbnail
Thanks !
Provide hyperlink on image and send all the details you want on servlet as query string
<a href="ServletName?name=${product.name}&price=${product.price}">
<img src="data:image/jpeg;base64,${product.base64EncodedImage}" alt="image"/>
</a>
OR
Send only product id and in servlet fetch all product details for that id from database
<a href="ServletName?id=${product.id}">
<img src="data:image/jpeg;base64,${product.base64EncodedImage}" alt="image"/>
</a>
I have html like so:
<div id="myId">
<a href="#">
<div class="name">Item1</div>
<span class="location">32143|2323</span>
</a>
<a href="#">
<div class="name">Item1</div>
<span class="location">32143|2323</span>
</a>
<a href="#">
<div class="name">Item1</div>
<span class="location">32143|2323</span>
</a>
</html>
Using HtmlUnit for Java, I need to grab the name and location of each anchor. I tried doing a getByXPath to pickup all the anchors, then looping through them with a for and running another getByXpath to get the name in the div. However the individual items in the list are apparently Objects, so I am unable to run a second getByXPath.
I also tried running the first getByXPath using "/a/div[#class='name']" to which I loop through the results which are Objects and I cannot find the proper method for returning the contents of the divs.
If your xpath select element, you can cast the list to the desired type:
List<HtmlElement> divs = (List<HtmlElement>)document.getByXPath("//a/div[#class='name']");