Need to summarize a dynamic xpath - selenium

I have a far too large dynamic xpath and would like to know if there is a shortened version that can be used. This is for a legend to a chart object, "Campaign Response" (which cannot be found by contains(text(), as it is embedded within the chart and isn't recognized as a string.) There are 4 locations of "Campaign Response" at different locations on different charts on the same screen.
I've tried using dynamic (//) body//section//div etc, and tend to wind up with something that grabs multiple objects.
//body[contains(#class,'desktop')]
/div[contains(#class,'desktop container forceStyle oneOne
lafStandardLayoutContainer lafAppLayoutHost forceAccess forceStyle
oneOne')]
/div[contains(#class,'viewport')]
/section[contains(#class,'stage panelSlide hasFixedFooter')]
/div[#id='brandBand_1']
/div[contains(#class,'slds-template__container')]
/div[contains(#class,'center oneCenterStage lafSinglePaneWindowManager')]
/div[contains(#class,'windowViewMode-normal oneContent active lafPageHost')]
/div[contains(#class,'container homeLanding')]
/div[contains(#class,'flexipagePage')]
/div[contains(#class,'responsiveContents homeDesktopTemplate')]
/div[contains(#class,'colMain')]
/div[contains(#class,'bottomWrapper')]
/div[contains(#class,'bottomLeft')]
/div[4]
/article[1]
/div[2]
/div[1]
/div[1]
/div[1]
/div[1]
/div[2]
/div[1]
/div[2]
/div[1]
/div[1]
html snippet - DIV CLASS="PS-CONTAINER" DATA-PS-ID="70C963EF-4CA2-07A3-6B48-394D11135709" is what is highlighted when looking at the code.
<div class="loadingPanel" data-aura-rendered-by="27:812;a"></div><span class="loadingMsg" data-aura-rendered-by="28:812;a">Loading report chart...</span></div>
<!--render facet: 75:812;a-->
<!--render facet: 82:812;a-->
<!--render facet: 96:812;a-->
<div class="eclair-component-container reportsEclairChart" data-aura-rendered-by="106:812;a" data-aura-class="reportsEclairChart" style="">
<div class="eclair-component-chart" data-aura-rendered-by="107:812;a" data-ngname="chart_0" style="width: 464.609px;">
<div style="position: relative;">
<div style="z-index: 2; position: absolute; overflow: hidden; background-color: rgba(255, 255, 255, 0); width: 464.609px; height: 300px; left: 0px; top: 0px;" class="ps-container" data-ps-id="aee85f92-8bd4-9aeb-b095-68aac4a00821">
<div style="width: 465px; height: 300px;"></div>
<div class="ps-scrollbar-x-rail" style="left: 0px; bottom: 3px;">
<div class="ps-scrollbar-x" style="left: 0px; width: 0px;"></div>
</div>
<div class="ps-scrollbar-y-rail" style="top: 0px; right: 3px;">
<div class="ps-scrollbar-y" style="top: 0px; height: 0px;"></div>
</div>
</div>
<canvas class="chart" style="z-index: 1; position: absolute; -webkit-font-smoothing: antialiased; width: 464.609px; height: 300px; left: 0px; top: 0px;" width="464" height="300"></canvas>
<button aria-live="polite" class="reportsEclairChart ng-button assistiveText">Enable Tab Navigation for This Chart<span class="assistiveText">Enable table equivalent for screen reader users</span></button>
</div>
<div data-ngname="legend_chart_0" style="">
<div style="position: relative;">
<DIV CLASS="PS-CONTAINER" DATA-PS-ID="70C963EF-4CA2-07A3-6B48-394D11135709" STYLE="">
<div style=""></div>
<div class="ps-scrollbar-x-rail" style="left: 0px; bottom: 3px;">
<div class="ps-scrollbar-x" style="left: 0px; width: 0px;"></div>
</div>
<div class="ps-scrollbar-y-rail" style="top: 0px; right: 3px;">
<div class="ps-scrollbar-y" style="top: 0px; height: 0px;"></div>
</div>
</div>
<canvas class="legend" style="z-index: 2; position: absolute; -webkit-font-smoothing: antialiased; width: 124px; height: 88px; left: 338.609px; top: 2px;" width="124" height="88"></canvas>
</div>
</div>
<div class="ng-annotations-container" style="margin: 2px; width: 460.609px; height: 296px;"></div>
</div>
<div class="error-div hide" data-aura-rendered-by="108:812;a"></div><span class="eclair-component-alt-text" data-aura-rendered-by="109:812;a">Chart: Priority Campaigns by Response</span></div>
<!--render facet: 111:812;a-->
</div>
</div>
</div>
<div class="lightning" data-aura-rendered-by="113:812;a"><span class="reportFooter" data-aura-rendered-by="114:812;a"><button class="slds-button navigateButton uiButton" aria-live="off" type="button" data-aura-rendered-by="118:812;a" data-aura-class="uiButton"><!--render facet: 119:812;a--><span class=" label bBody" dir="ltr" data-aura-rendered-by="121:812;a">View Report</span>
<!--render facet: 123:812;a-->
</button>
<div class="refreshContainer" data-aura-rendered-by="125:812;a"><span class="asOfDate" data-aura-rendered-by="128:812;a">As of Today at 10:​33 AM</span>
<button class="slds-button refreshButton uiButton" aria-live="off" type="button" data-aura-rendered-by="137:812;a" data-aura-class="uiButton">
<!--render facet: 138:812;a--><span class="assistiveText" data-aura-rendered-by="141:812;a">Refresh</span>
<lightning-icon class="slds-icon-utility-refresh slds-icon_container" data-data-rendering-service-uid="393" data-aura-rendered-by="135:812;a">
<lightning-primitive-icon lightning-primitiveicon_primitiveicon-host="">
<svg lightning-primitiveIcon_primitiveIcon="" focusable="false" data-key="refresh" aria-hidden="true" class="slds-icon slds-icon-text-default slds-icon_xx-small">
<use lightning-primitiveIcon_primitiveIcon="" xlink:href="/_slds/icons/utility-sprite/svg/symbols.svg?cache=9.28.0#refresh"></use>
</svg>
</lightning-primitive-icon><span class="slds-assistive-text">Refresh</span></lightning-icon>
</button>
</div>
</span>
</div>

I presume you want to access the span tag contains Priority Campaigns by Response
Try following xpath:
//span[#class='eclair-component-alt-text'][contains(.,'Campaigns by Response')]
OR
//div[#data-aura-class='reportsEclairChart']//span[#class='eclair-component-alt-text'][contains(.,'Campaigns by Response')]
Edited
To access the canvas element try below xpath.
//div[#class='PS-CONTAINER']/following::canvas[#class='legend']

Related

Trying to find dynamic xpath for the "view report" button

<div data-component-id="flexipage_reportChart8" data-aura-rendered-by="820:0" class="flexipageComponent" data-aura-class="flexipageComponent" xpath="1">
<article class="slds-card slds-card_boundary forceBaseCard flexipageCard flexipageReportChart" aria-describedby="header_923:0" data-aura-rendered-by="926:0" data-aura-class="forceBaseCard flexipageCard flexipageReportChart">
<div class="slds-card__header slds-grid" data-aura-rendered-by="146:1058;a">
<header class="slds-media slds-media--center slds-has-flexi-truncate" data-aura-rendered-by="148:1058;a">
<!--render facet: 150:1058;a-->
<div class="slds-media__body" data-aura-rendered-by="153:1058;a">
<h2 class="header-title-container" id="header_923:0" data-aura-rendered-by="154:1058;a"><span class="slds-card__header-title slds-truncate" title="More" data-aura-rendered-by="155:1058;a">More</span></h2></div>
</header>
<!--render facet: 157:1058;a-->
</div>
<div class="slds-card__body slds-card__body--inner" data-aura-rendered-by="928:0">
<div class="width_auto analyticsEmbeddedReportChart" data-aura-rendered-by="4:1058;a" data-aura-class="analyticsEmbeddedReportChart">
<!--render facet: 5:1058;a-->
<div class="outerbound" data-aura-rendered-by="10:1058;a">
<div class="chartContainer size_auto" data-aura-rendered-by="11:1058;a">
<!--render facet: 17:1058;a-->
<div class="autoWidth analyticsEmbeddedChart" style="height:300px;" data-aura-rendered-by="25:1058;a" data-aura-class="analyticsEmbeddedChart">
<div class="loadingMask hideLoading" data-aura-rendered-by="26:1058;a">
<div class="loadingPanel" data-aura-rendered-by="27:1058;a"></div><span class="loadingMsg" data-aura-rendered-by="28:1058;a">Loading report chart...</span></div>
<!--render facet: 30:1058;a-->
<!--render facet: 75:1058;a-->
<!--render facet: 82:1058;a-->
<!--render facet: 96:1058;a-->
<div class="eclair-component-container reportsEclairChart" data-aura-rendered-by="106:1058;a" data-aura-class="reportsEclairChart">
<div class="eclair-component-chart ng-cursor-default" data-aura-rendered-by="107:1058;a" data-ngname="chart_5" style="width: 380.844px;">
<div style="position: relative;">
<div style="z-index: 2; position: absolute; overflow: hidden; background-color: rgba(255, 255, 255, 0); width: 380.844px; height: 300px; left: 0px; top: 0px;" class="ps-container" data-ps-id="414c4b20-2e6b-f1a2-2116-7ff0144f88a4">
<div style="width: 381px; height: 300px;"></div>
<div class="ps-scrollbar-x-rail" style="left: 0px; bottom: 3px;">
<div class="ps-scrollbar-x" style="left: 0px; width: 0px;"></div>
</div>
<div class="ps-scrollbar-y-rail" style="top: 0px; right: 3px;">
<div class="ps-scrollbar-y" style="top: 0px; height: 0px;"></div>
</div>
</div>
<canvas class="chart" style="z-index: 1; position: absolute; -webkit-font-smoothing: antialiased; width: 380.844px; height: 300px; left: 0px; top: 0px;" width="571" height="450"></canvas>
<button aria-live="polite" class="reportsEclairChart ng-button assistiveText">Enable Tab Navigation for This Chart<span class="assistiveText">Enable table equivalent for screen reader users</span></button>
</div>
<div data-ngname="legend_chart_5" style="">
<div style="position: relative;">
<div class="ps-container" data-ps-id="1d1e50a4-a66a-2415-9d77-2a3c62481170" style="z-index: 3; position: absolute; overflow: hidden; background-color: rgba(255, 255, 255, 0); width: 124px; height: 88px; left: 254.844px; top: 2px;">
<div style="width: 124.88px; height: 86px;"></div>
<div class="ps-scrollbar-x-rail" style="left: 0px; bottom: 3px;">
<div class="ps-scrollbar-x" style="left: 0px; width: 0px;"></div>
</div>
<div class="ps-scrollbar-y-rail" style="top: 0px; right: 3px;">
<div class="ps-scrollbar-y" style="top: 0px; height: 0px;"></div>
</div>
</div>
<canvas class="legend" style="z-index: 2; position: absolute; -webkit-font-smoothing: antialiased; width: 124px; height: 88px; left: 254.844px; top: 2px;" width="186" height="132"></canvas>
</div>
</div>
<div class="ng-annotations-container" style="margin: 2px; width: 376.844px; height: 296px;"></div>
</div>
<div class="error-div hide" data-aura-rendered-by="108:1058;a"></div><span class="eclair-component-alt-text" data-aura-rendered-by="109:1058;a">Chart: Untitled</span></div>
<!--render facet: 111:1058;a-->
</div>
</div>
</div>
<DIV CLASS="LIGHTNING" DATA-AURA-RENDERED-BY="113:1058;A"><SPAN CLASS="REPORTFOOTER" DATA-AURA-RENDERED-BY="114:1058;A"><BUTTON CLASS="SLDS-BUTTON NAVIGATEBUTTON UIBUTTON" ARIA-LIVE="OFF" TYPE="BUTTON" DATA-AURA-RENDERED-BY="118:1058;A" DATA-AURA-CLASS="UIBUTTON"><!--RENDER FACET: 119:1058;A--><SPAN CLASS=" LABEL BBODY" DIR="LTR" DATA-AURA-RENDERED-BY="121:1058;A">VIEW REPORT</SPAN>
<!--render facet: 123:1058;a-->
</button>
<div class="refreshContainer" data-aura-rendered-by="125:1058;a"><span class="asOfDate" data-aura-rendered-by="128:1058;a">As of Yesterday at 10:​15 AM</span>
<button class="slds-button refreshButton uiButton" aria-live="off" type="button" data-aura-rendered-by="137:1058;a" data-aura-class="uiButton">
<!--render facet: 138:1058;a--><span class="assistiveText" data-aura-rendered-by="141:1058;a">Refresh</span>
<lightning-icon class="slds-icon-utility-refresh slds-icon_container" data-data-rendering-service-uid="602" data-aura-rendered-by="135:1058;a">
<lightning-primitive-icon lightning-primitiveicon_primitiveicon-host="">
<svg lightning-primitiveIcon_primitiveIcon="" focusable="false" data-key="refresh" aria-hidden="true" class="slds-icon slds-icon-text-default slds-icon_xx-small">
<use lightning-primitiveIcon_primitiveIcon="" xlink:href="/_slds/icons/utility-sprite/svg/symbols.svg?cache=9.28.0#refresh"></use>
</svg>
</lightning-primitive-icon><span class="slds-assistive-text">Refresh</span></lightning-icon>
</button>
</div>
</span>
</div>
</div>
</div>
<div class="slds-card__footer" data-aura-rendered-by="930:0">
<!--render facet: 931:0-->
</div>
</article>
</div>
I am trying to find a dynamic xpath for a large section of code. When I pull the dynamic xpath from chropath, I receive a very large response, which is too large to include in the test
I've tried trimming the dynamic xpath pulled from chropath but cannot seem to do so. I have capitalized the section of the code that is relevant.
More
Loading report chart...
Enable Tab Navigation for This ChartEnable table equivalent for screen reader users
Chart: Untitled
<!--render facet: 111:1058;a-->
</div>
</div>
</div>
<DIV CLASS="LIGHTNING" DATA-AURA-RENDERED-BY="113:1058;A"><SPAN CLASS="REPORTFOOTER" DATA-AURA-RENDERED-BY="114:1058;A"><BUTTON CLASS="SLDS-BUTTON NAVIGATEBUTTON UIBUTTON" ARIA-LIVE="OFF" TYPE="BUTTON" DATA-AURA-RENDERED-BY="118:1058;A" DATA-AURA-CLASS="UIBUTTON"><!--RENDER FACET: 119:1058;A--><SPAN CLASS=" LABEL BBODY" DIR="LTR" DATA-AURA-RENDERED-BY="121:1058;A">VIEW REPORT</SPAN>
<!--render facet: 123:1058;a-->
</button>
<div class="refreshContainer" data-aura-rendered-by="125:1058;a"><span class="asOfDate" data-aura-rendered-by="128:1058;a">As of Yesterday at 10:​15 AM</span>
<button class="slds-button refreshButton uiButton" aria-live="off" type="button" data-aura-rendered-by="137:1058;a" data-aura-class="uiButton">
<!--render facet: 138:1058;a--><span class="assistiveText" data-aura-rendered-by="141:1058;a">Refresh</span>
<lightning-icon class="slds-icon-utility-refresh slds-icon_container" data-data-rendering-service-uid="602" data-aura-rendered-by="135:1058;a">
<lightning-primitive-icon lightning-primitiveicon_primitiveicon-host="">
<svg lightning-primitiveIcon_primitiveIcon="" focusable="false" data-key="refresh" aria-hidden="true" class="slds-icon slds-icon-text-default slds-icon_xx-small">
<use lightning-primitiveIcon_primitiveIcon="" xlink:href="/_slds/icons/utility-sprite/svg/symbols.svg?cache=9.28.0#refresh"></use>
</svg>
</lightning-primitive-icon><span class="slds-assistive-text">Refresh</span></lightning-icon>
</button>
</div>
</span>
</div>
</div>
</div>
<div class="slds-card__footer" data-aura-rendered-by="930:0">
<!--render facet: 931:0-->
</div>
</article>
I need a shorter dynamic xpath
Does this work?
//button[text() = 'VIEW REPORT' or text() = 'view report' or text() = 'View Report']
If there are multiple View Report links showing up in the page, you can choose an item like
(//button[text() = 'view report'])[1]

Why are my columns overlapping vertically when I resize browser?

I'm practising bootstrap responsive web development, I've managed to make my webpage fairly responsive when I change the width however my middle columns overlap if I resize vertically. Here's the code:
<div class="container-fluid con">
<div class="row">
<div class="col-md-2 d-none d-md-block col1">
</div>
<div class="col-md-6 col2">
<p id="header-p">Full stack developer specialising in responsive website design and smooth user experience. Practical experience in project management, branding strategy, and creative direction; devoted to functional programming and information architecture</p>
<hr id="hr1">
<p id="header-tag">Web Developer - User Experience Designer - Graphic Artist
</p>
</div>
<div class="col-md-2 pic-col">
<img class="img-responsive rounded-circle img-thumbnail" src="#">
</div>
<div class="col-md-2 d-none d-md-block col1">
</div>
</div>
</div>
<div class="container-fluid con2">
<div class="row">
<div class="col-md-2 d-none d-md-block col1"></div>
<div class="col-md-8 port-col"><h2 id="portfolio-header">Portfolio</h2>
<hr id="hr2">
</div>
<div class="col-md-2 d-none d-md-block col1">
</div>
</div>
</div>
And the CSS:
#header-p{
margin-top: 10%;
text-align: center;
color: white;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size:20px;
}
#header-tag{
padding-top: 1rem;
text-align: center;
color: white;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size:20px;
}
.con{
margin: 4rem auto 2rem auto;
}
.col1, .col3{
border: 1px solid #bfbfbf;
background-color: #bfbfbf;
height: 100vh;
}
.col2{
background-color: #cccccc;
height: 60vh;
}
.pic-col{
background-color: #cccccc;
height: 60vh;
}
#portfolio-header{
text-align: center;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 60px;
letter-spacing: 5px;
/*line-height: 90px;*/
max-width: 100%;
color: #b3b3b3;
}
.port-col{
max-height: 100vh;
}
.con2{
margin: 2rem auto 2rem auto;!important
}
the full code is here if I'm missing anything https://codepen.io/Seaplush/pen/rKVLmX

JSSOR Slider: change tiled menu slider layout from 2 to 4 rows?

How can I add 2 more rows to the JSSOR tiled menu slider? Thank you.
Given a slide defined as follows, you will see all content in a slide is fully customizable. To define 4 rows instead of 2 rows, you can edit css.
<div>
<a class=appicon01 style="left: 0px; top: 0px; background-position:0px 0px;" href="#">
<div class=appiconcb></div>
<div class=appiconc>Menu Item 01</div>
</a>
<a class=appicon01 style="left: 160px; top: 0px; background-position:-160px 0px;" href="#">
<div class=appiconcb></div>
<div class=appiconc>Menu Item 02</div>
</a>
<a class=appicon01 style="left: 320px; top: 0px; background-position:-320px 0px;" href="#">
<div class=appiconcb></div>
<div class=appiconc>Menu Item 03</div>
</a>
<a class=appicon01 style="left: 480px; top: 0px; background-position:-480px 0px;" href="#">
<div class=appiconcb></div>
<div class=appiconc>Menu Item 04</div>
</a>
<a class=appicon01 style="left: 640px; top: 0px; background-position:-640px 0px;" href="#">
<div class=appiconcb></div>
<div class=appiconc>Menu Item 05</div>
</a>
<a class=appicon01 style="left: 0px; top: 160px; background-position:0px -160px;" href="#">
<div class=appiconcb></div>
<div class=appiconc>Menu Item 06</div>
</a>
<a class=appicon01 style="left: 160px; top: 160px; background-position:-160px -160px;" href="#">
<div class=appiconcb></div>
<div class=appiconc>Menu Item 07</div>
</a>
<a class=appicon01 style="left: 320px; top: 160px; background-position:-320px -160px;" href="#">
<div class=appiconcb></div>
<div class=appiconc>Menu Item 08</div>
</a>
<a class=appicon01 style="left: 480px; top: 160px; background-position:-480px -160px;" href="#">
<div class=appiconcb></div>
<div class=appiconc>Menu Item 09</div>
</a>
<a class=appicon01 style="left: 640px; top: 160px; background-position:-640px -160px;" href="#">
<div class=appiconcb></div>
<div class=appiconc>Menu Item 10</div>
</a>
</div>

change content when resize in gridster.js

i just learn to using gridster, and i want to create a card show general infomation and when user select expand the card, this wil change content and show full infomation off the product!
this is the card before click expand
<ul>
<li class="firm" data-row="1" data-col="1" data-sizex="1" data-sizey="1">
<div style="width: 95%; height: 80%; float: left; margin: 5px" id="divMain_1">
<div id="headerCol" style="width: 100%; height: 15%">
<span id="quankul">asset under management</span>
</div>
<div id="totalCol" style="width: 100%; height: 25%">
<span class="bold secondDiv" style="font-size: 24px">$1.41 Billion</span> <span class="bold">
(total asset)</span>
</div>
<div class="secondDiv" style="width: 100%; height: 50%; float: left">
<div style="float: left; width: 100%">
<div style="float: left; width: 70%">
<span class="bold">Top 3 Plan</span>
</div>
<div style="float: left; width: 30%">
</div>
</div>
<div style="float: left; width: 100%">
<div style="float: left; width: 70%">
<span>Seafood Gallery</span>
</div>
<div style="float: left; width: 30%">
<span>$100.000</span>
</div>
</div>
<div style="float: left; width: 100%">
<div style="float: left; width: 70%">
<span>ACME Enterprise</span>
</div>
<div style="float: left; width: 30%">
<span>$200.000</span>
</div>
</div>
<div style="float: left; width: 100%">
<div style="float: left; width: 70%">
<span>Ashley Cleaning</span>
</div>
<div style="float: left; width: 30%">
<span>$300.000</span>
</div>
</div>
</div>
</div>
<div id="expand" style="width: 100%;padding-bottom:0px; float: right;text-align:right">
<span>Expand</span>
</div>
<div id="collapse" style="width: 100%;padding-bottom:10px;height:20%;text-align:right;display:none">
<span>Collapse</span>
</div>
</li>
and when i click "expand" this will show ful infomation about the product;
can you help me to do it!

clearing out dojox/mobile/Accordion contained objects

I'm trying to destroy descendants of Accordion, that is I have 4 Content Panes within an Accrdion and then when I get new data I want to repopulate the accordion with that data(eg 5 ContentPanes) but the issue is that Once I call destroyDescendants on the accordion the content panes still reside within as dijit__Contained objects left from previous data:
<div class="mblAccordionTitle mblAccordionHasIcon mblAccordionTitleSelected" id="dijit__Contained_0" widgetid="dijit__Contained_0" style="-webkit-user-select: none;">
<a class="mblAccordionTitleAnchor" role="presentation">
<div class="mblAccordionIconParent mblAccordionIconParent2">
<div class="mblSpriteIconParent" style="position: relative; width: 32px; height: 32px;">
<img alt="" src="images/i.png" class="mblSpriteIcon" style="position: absolute; clip: rect(0px 32px 32px 0px ); top: 0px; left: 0px;">
</div>
</div>
<div class="mblAccordionIconParent mblAccordionIconParent1">
<div class="mblSpriteIconParent" style="position: relative; width: 32px; height: 32px;">
<img alt="" src="images/i.png" class="mblSpriteIcon" style="position: absolute; clip: rect(0px 64px 32px 32px); top: 0px; left: -32px;">
</div>
</div>
<div class="mblAccordionTitleTextBox" role="tab" tabindex="0" aria-controls="widget/PersonContainerContentPane" aria -selected="true" aria-posinset="1" aria-setsize="4">
<span class="mblAccordionTitleLabel">John Smith
</span>
</div>
</a>
</div>
Also the contained object is not a child of accordion...
Is there any way to get rid of this when I call destroyDescendants on accordion?
That solved my problem:
for (var i = this.accordion.containerNode.childNodes.length - 1; i >= 0; i--) {
registry.byId(this.accordion.containerNode.childNodes[i].id).destroyRecursive(false);
};
Don't know why destroyDescendants didn't clean up leftover html.