[#list activeChannels?sort_by("number") as channel]
<div class="kanal">
<div class="row">
<div class="column20" style="display: inline-block; vertical-align: middle;">
<div><input type="checkbox" class="regular-checkbox big-checkbox" style="vertical-align: middle;" id="${channel.id}" ${channelSubscriptions?seq_contains(channel.id)?string("checked='checked'", "")}/>
<label for="${channel.id}"></label></div>
</div>
<div class="column80"><div style="width:30%; float:left;">
[#if channel.imageUrl?has_content]
<img src=" ${channel.imageUrl} " style="width: 85%; display: inline-block; vertical-align: middle;"> <!-- Bildgröße-->
[#else] [/#if]</div>
<div class="title" style="width:70%; float:left;">${channel.name}[#if channel.description?has_content]<br /><span style="font-style:italic; font-weight:normal;">${channel.description}</span>[/#if]</div>
</div>
</div>
<div style="clear: both;"></div>
</div>
[#if channel_has_next]
<div style="height: 20px; width: 100%;"></div> <!--Abstand zwischen Kanälen-->
[/#if]
[/#list]
What is does:
it list all active Channels in a row from number 1 to 10
What i want it to do:
i want list all active Channels from number 1-4 and 6-10
Does somebody can help?
You will need to loop with index as below while ignoring specific index as 5:
<#list 0..10 as i>
<#if x != 5>
${activeChannels[i]}
</#if>
</#list>
In your case if channel is a number just add after list
[#list activeChannels?sort_by("number") as channel]
[#if channel.number != 5]
And close if before [/#list] as:
[/#if] [/#list]
Related
What is the best way to Change width of drop down in semantic UI, so that it will be responsive.
<div id="city" class="colomn ui search selection dropdown" style="min-width: 121px; white-space: nowrap; max-width: 251px;">
<input type="hidden" name="country">
<i class="dropdown icon"></i>
<div class="default text">Select City</div>
<div class="menu">
<div class="item" data-value="Ahmedabad">Ahmedabad</div>
<div class="item" data-value="Bangalore">Bangalore</div>
<div class="item" data-value="Chennai">Chennai</div>
<div class="item" data-value="Delhi">Delhi</div>
<div class="item" data-value="Hyderabad">Hyderabad</div>
<div class="item" data-value="Kolkata">Kolkata</div>
<div class="item" data-value="Mumbai">Mumbai</div>
</div>
</div>
<style>
.ui.dropdown>.text {
display: block !important;
overflow: hidden;
}
</style>
Below is the code :
I want to select the radio button which is present within the span class. Could you please help in identifying a successful xpath ?
<div id="quicklinkbox" class="col-md-2" data-position="left" data-intro="You can directly download payslip PDFs for the last 3 or 6 months. (India payslip only)" data-step="4">
<div style="background-color: transparent; margin-top: 28px;">
<div id="panel-title" ng-click="changeExpand(expand);" style="position: relative; left: 24px; cursor: pointer; font-weight: 500;">Quick Download</div>
<div id="panel-title" class="panel-body" style="text-align: left; font-weight: lighter; padding: 5px 0px 0px 50px; font-weight: 400">
<span style="margin-left: -16px;">Payslips for</span>
<form class="ng-pristine ng-valid">
<div class="form-group">
<div class="radio">
<span same-heightcol="" style="font-size: 16px;">
<input class="ng-pristine ng-valid" type="radio" ng-model="payslipselectedopt" style="cursor: pointer;" value="3" name="payslipradio"/>
<span style="font-size: 16px; position: relative; top: -5px;">Last 3 months</span>
</span>
</div>
<div class="radio">
<span style="font-size: 16px;">
<input class="ng-pristine ng-valid" type="radio" ng-model="payslipselectedopt" value="6" name="payslipradio" style="cursor: pointer;"/>
<span style="font-size: 16px; position: relative; top: -5px;"> Last 6 months</span>
</span>
</div>
<img style="margin-bottom: -12px; margin-left: -16px; cursor: pointer;" ng-click="downloadbulkpayslip()" src="appResources/images/Download-button.png"/>
</div>
</form>
</div>
</div>
</div>
</div>
You can use:
//span/input[#name='payslipradio' and #value='6']
Explanation:
//span -> Will search in all HTML al span tag
/input -> Will searth inside the span tag previous selected a input tag
[#name='payslipradio' and #value='6'] -> Will search in the previous selected tags one that the name attr is equals to 'pslpradio' and value attr equals to '6'
//*span[input#class='ng-pristine ng-valid' and #type='radio']))
Below is some HTML code, in which I need to find the element with the content win8 (last element, <div class="desc">win8</div>).
<div class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-draggable ui-resizable" style="display: block; z-index: 5002; outline: 0px none; position: absolute; height: auto; width: 800px; top: 7px; left: 537px;" tabindex="-1" role="dialog" aria-labelledby="ui-dialog-title-1">
<div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix">
<div class="multi-wizard instance-wizard ui-dialog-content ui-widget-content" style="width: auto; min-height: 0px; height: 518px;">
<div class="progress">
<form novalidate="novalidate">
<div class="steps">
<div class="step setup loaded" wizard-step-id="setup" style="display: none;">
<div class="step select-iso loaded" wizard-step-id="select-iso" style="display: block;">
<div class="wizard-step-conditional select-template" style="display: block;">
<div class="main-desc">
<div class="template-select content tab-view ui-tabs ui-widget ui-widget-content ui-corner-all">
<ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
<input type="hidden" value="XenServer" name="hypervisor" wizard-field="hypervisor">
<div id="instance-wizard-featured-templates" class="ui-tabs-panel ui-widget-content ui-corner-bottom">
<div class="select-container">
<div class="select **even**">
<input type="radio" name="templateid" wizard-field="template" value="b0c24832-6fdf-11e4-a45f-b6eb114441ae">
<div class="select-desc">
</div>
<div class="select **odd**">
<input type="radio" name="templateid" wizard-field="template" value="7720cdb2-b81a-4839-94cd-b56b660e3324">
<div class="select-desc">
<div class="name">win8</div>
<div class="desc">win8</div>
</div>
</div>
I tried the following XPath:
.//*[#id='instance-wizard-featured-templates']/div/div[2]/input
The issue is the screen has 2 elements, even and odd. Each time it loads it swaps the values. So the XPath selects the wrong element.
Is there a way to exactly select win8?
Assuming you always want to get the element with the class named 'desc', the correct XPath is looks like this:
//div[#class="desc" and text()="win8"]
This selects all <div> elements having the class 'desc' and 'win8' as text.
Can anyone help me how to match this element, I want to click Canada from the list of countries. Selenium (IDE/WebDriver) is not finding the element.
I have tried in Webdriver:
driver.FindElement(By.XPath(".//*[#class='slick-viewport']/*[#class='grid-canvas']/*[#class='ui-widget-content slick-row odd']/*[#class='slick-cell l1 r1 active selected']")).click();
Firepath gives this XPath:
.//*[#id='assetsTable']/div[5]/div/div[5]/div[2]
Neither of these are working. Obviously, I am not doing correctly. The ids are generated dynamically, and nested, so I'm finding it very difficult to work out. Can anyone have a look and tell me the correct way for the locator please?
Many thanks
PS: Looks like I am not allowed to upload image. So, copy pasted the content below:
<!DOCTYPE html>
<html class="dj_gecko dj_contentbox">
<head>
<body id="bodyID">
<div id="pageDiv" class="page">
<div id="header">
<div id="main">
<ul id="mainMenu" class="menuTab">
<div id="partialHost" style="height: 345.117px;">
<div id="assetsBreadcrumbDiv">
<div id="assetsGridDiv">
<ul id="assetMenu" class="menuTab">
<div id="assetsTable" class="defaultGrid slickgrid_109601 ui-widget" style="overflow: hidden; outline: 0px none; position: relative; height: 269.117px; width: 1562px;">
<div style="position:fixed;width:0;height:0;top:0;left:0;outline:0;" hidefocus="" tabindex="0"></div>
<div class="slick-header ui-state-default" style="overflow:hidden;position:relative;">
<div class="slick-headerrow ui-state-default" style="overflow: hidden; position: relative; display: none;">
<div class="slick-top-panel-scroller ui-state-default" style="overflow: hidden; position: relative; display: none;">
<div class="slick-viewport" style="width: 100%; overflow: auto; outline: 0px none; position: relative; height: 242px;">
<div class="grid-canvas" style="width: 1545px; height: 5975px;">
<div class="ui-widget-content slick-row odd" style="top:775px">
<div class="ui-widget-content slick-row even" style="top:800px">
<div class="ui-widget-content slick-row odd" style="top:825px">
<div class="ui-widget-content slick-row even" style="top:850px">
<div class="ui-widget-content slick-row odd" style="top:875px">
<div class="slick-cell l0 r0 selected">CA</div>
<div class="slick-cell l1 r1 active selected">CANADA</div>
<div class="slick-cell l2 r2 selected">Y</div>
<div class="slick-cell l3 r3 selected"></div>
<div class="slick-cell l4 r4 selected">CA</div>
</div>
<div class="ui-widget-content slick-row even" style="top:900px">
<div class="ui-widget-content slick-row odd" style="top:925px">
<div class="ui-widget-content slick-row even" style="top:950px">
//div[text()="CANADA"] should work. If you only want that particular element that is.
Don't use * , be explicit in XPath queries.
This works:
//div[#class='slick-cell l1 r1 active selected']
What do you get when you try your XPath query directly in FireBug?
I have a input field
<body>
<center>
<div style="margin-top : 1px; border:1px solid #e4e4e4; width : 500px; background: #efefef; box-shadow : 0px 0px 20px 10px #e5e5e5 inset;">
<p style="font-size: 18pt; font-family: verdana; text-shadow: 0px 0px 4px #000; color:#fff;">Student Exam Data</p>
<form onsubmit="return message()">
<p class="heading">Student Details</p>
<p class="data">
<label>Roll Number</label><input type="text" name="rollno" id="rollno" maxlength="4"/>
</p>
<p class="heading">Marks Obtained For Languages</p>
<p class="data">
<label>English</label><input type="text" name="english" id="english" onchange="calculate()" maxlength="3"/>
</p>
<p class="data">
<label>Konkani</label><input type="text" name="konkani" id="konkani" onchange="calculate() maxlength="3""/>
</p>
<p class="heading">Marks Obtained For Natural Science</p>
<p class="data">
<label>Maths</label><input type="text" name="maths" id="maths" onchange="calculate() maxlength="3""/>
</p>
<p class="data">
<label>Physics</label><input type="text" name="physics" id="physics" onchange="calculate() maxlength="3""/>
</p>
<p class="data">
<label>Chemistry</label><input type="text" name="chemistry" id="chemistry" onchange="calculate() maxlength="3""/>
</p>
<p class="heading">Marks Obtained For Social Science</p>
<p class="data">
<label>Geography</label><input type="text" name="geography" id="geography" onchange="calculate() maxlength="3""/>
</p>
<p class="heading">Total Marks Obtained</p>
<p class="data">
<label>Total Marks</label><input type="text" name="total" id="total" readonly="readonly"/>
</p>
<p class="heading">Percentage</p>
<p class="data">
<label>Percentage</label><input type="text" name="percentage" id="percentage" readonly="readonly"/>
</p>
<p>
<input type="submit" value="Submit">
</p>
<input type="hidden" name="mode" value="set">
</form>
</div>
</center>
<c:if test="${param.mode == 'set'}">
roll number<c:out value="${param.rollno}"></c:out>
<c:catch var="exception">
<sql:setDataSource var="examDatabase" password="" user="root" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/examination"/>
<sql:update var="result" sql="insert into student_examdata values(?,?,?,?,?,?,?,?,?)" dataSource="${examDatabase}">
<sql:param value="${param.rollno}.trim()"></sql:param>
<sql:param value="${param.english}.trim()"></sql:param>
<sql:param value="${param.maths}.trim()"></sql:param>
<sql:param value="${param.physics}.trim()"></sql:param>
<sql:param value="${param.chemistry}.trim()"></sql:param>
<sql:param value="${param.konkani}.trim()"></sql:param>
<sql:param value="${param.geography}.trim()"></sql:param>
<sql:param value="${param.total}.trim()"></sql:param>
<sql:param value="${param.percentage}.trim()"></sql:param>
</sql:update>
</c:catch>
<c:if test="${exception != null }">
<p class="error">
<strong style="background : #fff; color:#000; width : 300px;">Exception</strong><br><br>
<c:out value="${exception.message}"></c:out>
</p>
</c:if>
</c:if>
</body>
the data type of the field roll_no is varchar(4).
Error is:
insert into student_examdata values(?,?,?,?,?,?,?,?,?): Data truncation: Data too long for column 'roll_no' at row 1
please help.
something is seriously wrong here!
<sql:param value="${param.rollno}.trim()"></sql:param>
if you are trying to trim the rollno, please use this
<sql:param value="${param.rollno.trim()}"></sql:param>
i hope that will answer your problem!