I want to build Xpath for following tab - selenium-webdriver

I want to buid Xpath for depart date drop down date field
https://www.southwest.com/air/booking/index.html?int=HOME-BOOKING-WIDGET-ADVANCED-AIR
I have tried so many combinations but its not working.
example -
//input[#id='departureDate']/span[#class='swa-icon--icon']
//span[#class='swa-icon--icon']
<div class="flyout-trigger date-input"><div class="input input_icon input_left input_secondary"><input type="text" aria-label="Depart Date in mm/dd/yyyy format, valid dates from Jun 12 2019 to Jan 5 2020. To use a date picker press the down arrow." aria-owns="calendar-14" autocapitalize="none" autocomplete="off" autocorrect="off" id="departureDate" spellcheck="false" aria-required="true" class="input--text"><div class="input--icon-separator"><span class="swa-icon input--icon swa-icon_calendar" icon="swa-icon_calendar" size="18" role="presentation" style="font-size: 18px;"><span role="presentation" class="swa-icon--icon"></span></span></div></div></div>
\

The easiest way is sticking to the value of aria-label attribute, you can utilize XPath contains() function in order to locate element basing on the partial text of the aforementioned aria-label atrribute, something like:
//input[contains(#aria-label,'Depart Date')]
Demo:
More information:
XPath Syntax
XPath Operators & Functions

Here is the xpath that you are looking for.
//span[normalize-space(.)='Return date']/following-sibling::div//span[#class='swa-icon--icon']

Related

Is there a way to concatenate multilines in [onshow; if [var.x]!='0'; then ' multilines here ';else '']

How to concatenate multiline string in [onshow if then else] condition with tbs variables?
Thanks for your help.
I work on windows 10 + WAMP.
I had try the code bellow. I suppose the problem is coming from the tbs variables incuded in. I did'nt find the way to eliminate this error:
"TinyButStrong Error : can't found the end of the tag '[onshow; if [var.x...'.
TinyButStrong Error : can't found the end of the tag '[onshow; if [var.x...'.
TinyButStrong Error : can't found the end of the tag '[onshow; if 0!='0'...'.
TinyButStrong Error : can't found the end of the tag '[onshow; if 0!='0'...'."
[onshow; if [var.x_created_dupli]!='0'; then '<td>
<select name="x_exercise" size="10" onchange="chooseExercise();">
<option value="[blk_exercise.key]">[blk_exercise.val;block=option;strconv=utf8]'</option>
<option>[onshow.x_exercise;ope=html;select]</option>
</select>
</td>
<td>
<input type="button" name="action" value="ajouter exercice" onclick="alterExercise([onshow.x_sessionType],2)"/>
</td>';else '']

Putting unix dates into angular table

I want to format my date from 1499992000 to Fri Jul 14 2017
<td> {{ new Date(vm.checkinDate*1000) }} </td>
Is there a way to do this directly on the page? Or will I have to do it in the controller?
All I get now is:
[$parse:syntax] Syntax Error: Token 'Date' is an unexpected token
try
Angular swill be able to parse a unix date into a date using the build in filters
<td> {{vm.checkinDate*1000 | date : 'EEE MMM dd yyyy' }} </td>

Hierarchical XML to Table in SQL Server

I'm trying to convert data streaming from a medical device into a usable table. The device spits out XML-formatted text via an RS-232 port, which I've captured using a software called ComCap4 from Magenta Systems. I've been able to convert the one row per line of text into an XML object, but am getting turned around by the XML syntax in SQL Server.
Here's an example of the XML:
<sample>
<instrinfo>
<p>
<n>SNO</n>
<v>179</v>
</p>
</instrinfo>
<smpinfo>
<p>
<n>ID</n>
<v>26551.0</v>
</p>
</smpinfo>
<smpresults>
<p>
<n>WBC</n>
<v>8.4</v>
<l>3.5</l>
<h>10.0</h>
</p>
</smpresults>
</sample>
<sample>
<instrinfo>
<p>
<n>SNO</n>
<v>179</v>
</p>
</instrinfo>
<smpinfo>
<p>
<n>ID</n>
<v>26552.0</v>
</p>
</smpinfo>
<smpresults>
<p>
<n>WBC</n>
<v>6.1</v>
<l>3.5</l>
<h>10.0</h>
</p>
</smpresults>
</sample>
I'd like to convert this XML into a table that looks like:
InstrumentSNO SampleID WBCVal WBCLow WBCHigh
------------- -------- ------ ------ -------
179 26551.0 8.4 3.5 10.0
179 26552.0 6.1 3.5 10.0
I've had very little experience parsing XML (probably obvious from this question) and the examples I've found here and elsewhere leave me more confused than ever.
Any help, links, or suggestions in the right direction are greatly appreciated!
Try it like this:
DECLARE #xml XML=
'<sample>
<instrinfo>
<p>
<n>SNO</n>
<v>179</v>
</p>
</instrinfo>
<smpinfo>
<p>
<n>ID</n>
<v>26551.0</v>
</p>
</smpinfo>
<smpresults>
<p>
<n>WBC</n>
<v>8.4</v>
<l>3.5</l>
<h>10.0</h>
</p>
</smpresults>
</sample>
<sample>
<instrinfo>
<p>
<n>SNO</n>
<v>179</v>
</p>
</instrinfo>
<smpinfo>
<p>
<n>ID</n>
<v>26552.0</v>
</p>
</smpinfo>
<smpresults>
<p>
<n>WBC</n>
<v>6.1</v>
<l>3.5</l>
<h>10.0</h>
</p>
</smpresults>
</sample>';
--Here is the query
SELECT s.value('(instrinfo/p/v)[1]','int') AS InstrumentSNO
,s.value('(smpinfo/p/v)[1]','decimal(10,1)') AS SampleID
,s.value('(smpresults/p/v)[1]','decimal(10,1)') AS WBCVal
,s.value('(smpresults/p/l)[1]','decimal(10,1)') AS WBCLow
,s.value('(smpresults/p/h)[1]','decimal(10,1)') AS WBCHigh
FROM #xml.nodes('/sample') AS A(s)
The result
InstrumentSNO SampleID WBCVal WBCLow WBCHigh
179 26551.0 8.4 3.5 10.0
179 26552.0 6.1 3.5 10.0
Short explanation
Your XML contains - obviously - sets of sample element. With CROSS APPLY .nodes('/sample') we can address them one by one.
Although there are nested elements, all of them seem to be 1:1 named elements, so we can just pick them by their names with a relativ path down from the sample-node.

5 weeks datepicker in AngularJS

The datepicker (ui.bootstrap.datepicker) in AngularJS is presented with a 6-week calendar for a specified month.
How can we change it to a 5 weeks per month datepicker by default, and use 6 week rows only if necessary?
<input type="text" class="form-control datedesktop"
uib-datepicker-popup="{{format}}"
ng-model="dt"
is-open="popup1.opened"
datepicker-options="dateOptions"
ng-required="true"
show-button-bar="true"
show-weeks="false"
alt-input-formats="altInputFormats"
on-open-focus="false"
close-text="X"
clear-text=""
ng-click="open()" />
<span class="input-group-btn">
<button type="button" class="btn btn-default btn-calendar" ng-click="open()">
<i class="glyphicon glyphicon-calendar"></i>
</button>
</span>
as #svarog mentioned override the template is best approach.
There is no option given to change to 5 weeks.
if you see datepicker library ( line number 399 )
// 42 is the number of days on a six-week calendar
var days = this.getDates(firstDate, 42);
No.of weeks 42 (6 weeks * 7 days) is hardcoded. if you replace 42 by 35, (5 weeks * 7 rows ) this will gives you 5 weeks calendar.
Run into similar issue when had to hide row that doesn't belong to current month. Maybe my solution will be useful for someone. UI Bootstrap version 2.5.0
Overwrited uib/template/datepicker/day.html template.
"<tr class=\"uib-weeks\" ng-repeat=\"row in rows track by $index\" role=\"row\">\n"
changed to
"<tr class=\"uib-weeks\" ng-repeat=\"row in rows track by $index\" role=\"row\" ng-hide=\"row[0].secondary && row[6].secondary\">\n"
row[0].secondary && row[6].secondary condition checks if first and last days in week doesn't belong to current month.

"Could not get the type info from component xml schema" when loading a page in SiteEdit 2009

I enabled inline editing on SitEdit 2009 SP2 using the answer given here
How do I enable inline field editing in SiteEdit when using an XSLT TBB?
but I keep getting this error when loading the resulting page in SiteEdit:
Sys.FormatException: Could not get the type info from component xml schema.
Field: cf_tcm:20-33457-64_content_header
XPath: [1]
My XSLT TBB fragment:
<xsl:if test="//*[local-name()='content_header'] != ''">
<h1>
<div>
<tcdl:ComponentField name="content_header" index="0">
<xsl:value-of select="//*[local-name()='content_header']">
</tcdl:ComponentField>
</div>
</h1>
</xsl:if>
The output in the published file:
<h1>
<div>
<span>
<!-- Start SiteEdit Component Field: {"ID" : "cf_tcm:20-33457-64_content_header", "XPath" : "[1]", "IsMultiValued" : false} -->
<tcdl:ComponentField name="content_header" index="0" SiteEditProcessed="true">
Test
</tcdl:ComponentField>
</span>
</div>
</h1>
What is wrong with my code?
That error message means that the XPath in your <!-- Start SiteEdit Component Field: { ...} --> command does not point to a field in the current Component. Given that your XPath shows up as [1], that sounds pretty accurate.
You'll need to find the cause of the empty XPath being output. In your XSLT you mark the field with a <tcdl:ComponentField> wrapper. This wrapper is later processed by the "Enable Inline Editing" TBB to generate a corresponding <!-- Start SiteEdit Component Field ... --> command. Since the SiteEdit front-end needs an XPath to the field and the tcdl:ComponentField only contains the field name, the TBB will need to look up the XPath based on the field name.
The "Enable Inline Editing" TBB from SiteEdit 2009 looks up the current Component when processing tcdl:ComponentField by looking at the current resolved item (engine.PublishingContext.ResolvedItem.Item.Id). It then looks up the field in that Component to determine its XPath.
If you look at the package in the Template Builder, what is the Component at the bottom of the Package list? Does that Component contain a content_header field?

Resources