Unable to click on tile using Protractor - protractor

I am new user of Protractor. Need help as i am unable to click on Some Name, having below HTML
<div class="department-click"
<div class="department-click" onclick="GLOBAL_SERVICE_ID=405;changeLocation('#/aaaa');_routeFrom='home'">
<!-- <div class="department-click" onclick="changeLocation('#/aaaa')"> -->
<div class="department-icon custom-svgbg1 layout-column layout-align-center-center">
<!-- <svg style="height:80px; width:80px;" viewBox="0 0 24 24"> -->
<!-- <path fill="#fff" d="M12,3L1,9L12,15L21,10.09V17H23V9M5,13.18V17.18L12,21L19,17.18V13.18L12,17L5,13.18Z" /> -->
<!-- </svg> -->
<svg height="80px" viewBox="0 0 92.168 92.168" width="80px">
<rect clip-rule="evenodd" fill="none" fill-rule="evenodd" height="92.168" width="92.168" x="0"></rect>
<path d="M4.994,53.166V37.65l-3.248-1.418c-1.185-0.511-1.077-2.165,0.2-2.565l44.208-13.824 c0.255-0.091,0.566-0.091,0.821,0l44.244,13.915c1.26,0.4,1.26,2.182,0.019,2.6L47.123,55.385c-0.366,0.145-0.73,0.145-1.096-0.019 L7.731,38.832v14.352c1.022,0.219,1.86,0.673,2.554,1.309c2.499,2.257,2.573,6.312,1.807,9.351 c-0.766,2.947-2.482,5.802-5.018,7.403c-0.475,0.309-1.022,0.273-1.477-0.019c-2.592-1.618-4.361-4.456-5.146-7.366 c-0.802-3.036-0.711-7.021,1.752-9.293C2.968,53.875,3.899,53.384,4.994,53.166L4.994,53.166z M6.782,35.468 c0.091,0.017,0.183,0.053,0.255,0.091l39.556,17.096l40.322-17.388L46.557,22.57L6.18,35.195L6.782,35.468z M69.508,51.201 c0-0.745,0.602-1.365,1.368-1.365c0.749,0,1.368,0.619,1.368,1.365v10.532c0,5.22-6.951,8.531-15.781,9.894 c-6.495,1.001-13.74,1.037-20.233,0.019c-8.558-1.328-15.181-4.567-15.181-9.896V51.457c0-0.764,0.619-1.365,1.368-1.365 c0.747,0,1.368,0.6,1.368,1.365v10.294c0,3.675,5.619,6.076,12.863,7.204c6.221,0.982,13.172,0.945,19.395-0.019 c7.534-1.165,13.464-3.619,13.464-7.203V51.201z M3.096,63.17c0.547,2.018,1.643,3.983,3.248,5.257 c1.515-1.273,2.573-3.219,3.103-5.257c0.511-1.965,0.675-5.167-0.985-6.676c-1.151-1.018-3.286-0.945-4.397,0.072 C2.402,58.095,2.568,61.186,3.096,63.17L3.096,63.17z" fill="#3A3E49 "></path>
</svg>
</div>
<h3 class="clamp2">
<span>
Some Name
</span>
</h3>
</div>

Try locating the element by css:
element(by.css('.department-click .clamp2 span'));

Depends on which element you want to click, next line is locating the element by css and then clicking it:
element(by.css('h3.clamp2 span')).click();

Related

how to pass data to a Tailwind modal using Laravel

i have this code in tailwind
#foreach($studenti as $student)
<a data-modal-toggle="defaultModal" data-target="#myModal{{$student->id }} href="#" class="hover:text-blue-700">{{$student->name}}</a>
and this is the Main modal
<!-- Main modal -->
<div id="myModal{{$student->id}}" tabindex="-1" aria-hidden="true" class="hidden overflow-y-auto overflow-x-hidden fixed top-0 right-0 left-0 z-50 w-full md:inset-0 h-modal md:h-full justify-center items-center">
<div class="relative p-4 w-full max-w-2xl h-full md:h-auto">
<!-- Modal content -->
<div class="relative bg-white rounded-lg shadow dark:bg-gray-700">
<!-- Modal header -->
<div class="flex justify-between items-start p-4 rounded-t border-b dark:border-gray-600">
<h3 class="text-xl font-semibold text-gray-900 dark:text-white">
{{$alum->nombre}} {{$alum->apellpatern}} {{$alum->apellmatern}}
</h3>
<button type="button" class="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center dark:hover:bg-gray-600 dark:hover:text-white" data-modal-toggle="defaultModal">
<svg aria-hidden="true" class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg>
<span class="sr-only">Close modal</span>
</button>
</div>
<!-- Modal body -->
<div class="p-6 space-y-6">
<p class="text-base leading-relaxed text-gray-500 dark:text-gray-400">
With less than a month to go before the European Union enacts new consumer privacy laws for its citizens, companies around the world are updating their terms of service agreements to comply.
</p>
<p class="text-base leading-relaxed text-gray-500 dark:text-gray-400">
The European Union’s General Data Protection Regulation (G.D.P.R.) goes into effect on May 25 and is meant to ensure a common set of data rights in the European Union. It requires organizations to notify users as soon as possible of high-risk data breaches that could personally affect them.
</p>
</div>
<!-- Modal footer -->
<div class="flex items-center p-6 space-x-2 rounded-b border-t border-gray-200 dark:border-gray-600">
<button data-modal-toggle="defaultModal" type="button" class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">I accept</button>
<button data-modal-toggle="defaultModal" type="button" class="text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-blue-300 rounded-lg border border-gray-200 text-sm font-medium px-5 py-2.5 hover:text-gray-900 focus:z-10 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:text-white dark:hover:bg-gray-600 dark:focus:ring-gray-600">Decline</button>
</div>
</div>
</div>
</div>
#endforeach
But when i pressed the link it does not work, i am using data-target="#myModal{{$student->id }} in order to pass #student data to tailwind Main modal id="myModal{{$student->id}}",
it seems that this is not the proper way to pass data, i am using Laravel 8, anyhelp is appreciated
Thank you in advance
Omar

Relative path links are not working in iphone

I created an SVG menu for a single page website. When I use the menu from my computer everything works fine, but when I try to access from my phone, the links are not working. I noticed that the issue only happens if I use relative paths (I am only linking to the Id of the element) and with Iphones, I don’t have any issues with Android devices. My problem is that if I use absolute paths, I lose the scroll-behavior animation (smooth).
I don't know if this is issue with my SVG or that I simply can't use relative path in iphones.
This is the link for my project: http://portfolio-2019-cg.herokuapp.com
I am using React to create this website.
<div>
<svg className="circle" width="611px" onClick={this.showMenu} height="883px" viewBox="0 0 611 883" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlnsXlink="http://www.w3.org/1999/xlink">
<g id="Page-1" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
<path id='menu' className={this.state.activeclass} d="M611,473 L611,708 C611,804.649831 532.649831,883 436,883 L269,883 L60,883 C26.862915,883 1.11635499e-14,856.137085 7.10542736e-15,823 L1.08387875e-15,473 L-1.42108547e-14,60 C-1.82689772e-14,26.862915 26.862915,6.08718376e-15 60,0 L551,0 C584.137085,-6.08718376e-15 611,26.862915 611,60 L611,473 Z" id="Combined-Shape" fill="#FF531B"></path>
<circle id="Oval" fill="#FF531B" cx="436" cy="708" r="175"></circle>
<path className={this.state.plusclass} onClick={this.showMenu} d="M486,658.5 L561.5,658.5 L561.5,758.5 L486,758.5 L486,834 L386,834 L386,758.5 L310.5,758.5 L310.5,658.5 L386,658.5 L386,583 L486,583 L486,658.5 Z" id="Combined-Shape" fill="#080815"></path>
<g className={this.state.menuclass}>
<text id="HOME" fontSize="94" fontWeight="normal" fill="#080815">
<a xlinkHref="#home">
<tspan x="205.181641" y="140">Home</tspan>
</a>
</text>
<text id="ABOUT" fontSize="94" fontWeight="normal" fill="#080815">
<a xlinkHref="#about">
<tspan x="176.977051" y="270">About</tspan>
</a>
</text>
<text id="PORTFOLIO" fontSize="94" fontWeight="normal" fill="#080815">
<a xlinkHref="#portfolio">
<tspan x="64.1586914" y="400">Portfolio</tspan>
</a>
</text>
<text id="CONTACT" fontSize="94" fontWeight="normal" fill="#080815">
<a xlinkHref="#contact">
<tspan x="120.567871" y="530">Contact</tspan>
</a>
</text>
</g>
</g>
</svg>
</div>

protractor how to select element by svg or ng-click

I'm trying to click this element:
<a ng-click="vm.showEditOpportunity(3122)" class="btn btn-sm">
<svg class="svg-inline--fa fa-pencil-alt fa-w-16" style="color: #4b286d;"
data-toggle="tooltip" title="Edit this Opportunity"
aria-labelledby="svg-inline--fa-title-381" data-prefix="fas" data-icon="pencil-alt"
role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" data-fa-i2svg="">
<title id="svg-inline--fa-title-381">Edit this Opportunity</title>
<path fill="currentColor" d="M497.9 142.1l-46.1 46.1c-4.7 4.7-12.3 4.7-17
0l-111-111c-4.7-4.7-4.7-12.3 0-17l46.1-46.1c18.7-18.7 49.1-18.7 67.9 0l60.1
60.1c18.8 18.7 18.8 49.1 0 67.9zM284.2 99.8L21.6 362.4.4 483.9c-2.9 16.4
11.4 30.6 27.8 27.8l121.5-21.3 262.6-262.6c4.7-4.7 4.7-12.3
0-17l-111-111c-4.8-4.7-12.4-4.7-17.1 0zM124.1 339.9c-5.5-5.5-5.5-14.3
0-19.8l154-154c5.5-5.5 14.3-5.5 19.8 0s5.5 14.3 0 19.8l-154 154c-5.5
5.5-14.3 5.5-19.8 0zM88 424h48v36.3l-64.5 11.3-31.1-31.1L51.7 376H88v48z
</path>
</svg>
</a>
I have tried the following but none works, with error "no element found using locator: XXXXXX". What is the proper way of clicking this element?
element(by.css('[ng-click="vm.showEditOpportunity(3122)"]')).click();
element(by.xpath("//a[contains(text(),'vm.showEditOpportunity(3122)')]")).click();
element(by.xpath("//svg[#title='Edit this Opportunity']")).click();
Had the same problem with elements with ng-click. Describing them through the ng-click is fine, but the only way it works for me is to wait for visibility of the element with ExpectedConditions.
var element = element(by.css('[ng-click="vm.showEditOpportunity(3122)"]'));
browser.ignoreSynchronization = true;
browser.wait(protractor.ExpectedConditions.visibilityOf(element),500);
element.click();

Orbeon + jsf -> submit in selectonemenu

I have a problem with xforms, how refresh only rich:panel when I choose value from h:selectOneMenu :
<!--<h:form> call bean but--> <form><!--open start page-->
<h:selectOneMenu id="add" onchange="submit()" <!-- can't find context , error orbeon/java--> >
<!-- is not working <a4j:support event="onchange" actionListener="#{bean.action}"/> -->
<s:selectItems value="#{bean.List()}" var="message" itemValue="#{message}" label="#{message}" />
</h:selectOneMenu>
</form>
more Code JSF :
<form>
<rich:panel styleClass="DocumentBody" id="documentPanel"
name="panell" style="margin-top:10px; height:90px;">
<f:facet styleClass="documentHeader" name="header"></f:facet>
<div id="documentTest" class="actionButtons">
<div style="clear: both; height: 15px; width: 60px" />
<s:button id="addButton" value="#{messages['operation.save.button']}"
action="#{actionBean.generateNewName()}" reRender="confirm"
onclick="#{actionBean.generateNewName()};#{rich:component('confirm')}.show();return false;">
</s:button>
<s:button id="loadButton" value="#{messages['operation.load.button']}"
action="#{actionBean.loadDraft()}" reRender="documentTests,documentPanel,loadButton" />
<s:button id="deleteButton" value="#{messages['operation.delete.button']}"
action="#{actionBean.deleteDraft()}" reRender="documentTests,documentPanel,deleteButton" />
</div>
</rich:panel>
</form>
<h:form style="margin: 0;">
<h:selectOneMenu id="messageTypeAdd"
style="margin-right:5px; margin-top:-30px;margin-left:90px;"
valueChangeListener="#{actionBean.documentTestChange}"
enableManualInput="false" selectFirstOnUpdate="true"
directInputSuggestions="true" onchange="submit()">
<!-- submit() rerender all page, but i try refresh only modalPanel id="confirm" -->
<s:selectItems value="#{actionBean.getdocumentTestList()}"
var="message" itemValue="#{message}" label="#{message}" />
<!--a4j and f:ajax is not work, i try update JSF 1.2 to 2.0 -->
</h:selectOneMenu>
</h:form>
<rich:modalPanel id="confirm" autosized="true" width="300">
<f:facet name="header"></f:facet>
<rich:messages style="color:red;" globalOnly="true" />
<a4j:outputPanel ajaxRendered="true">
<h:panelGrid>
<h:panelGrid columns="2">
<h:outputText value="#{messages['report.name.label']}" />
<h:inputText id="newDraftNameInput" value="#{actionBean.newDraftName}"
valueChangeListener="#{actionBean.newDraftNameChange}">
</h:inputText>
</h:panelGrid>
</h:panelGrid>
</a4j:outputPanel>
</rich:modalPanel>

How to parse an <img> that is deep within a div using Element Parser?

I'm currently using an parser called Element Parser and I'm trying to parse an img tag that is the 4th img tag down under the div id "Group-E". I can retrieve the 2nd img but not anything after the 2nd img. The img that I'm wanting to parse is:
<img src="http://example.com/I_need_this_image_here.jpg" />.
How can this be done? So far I've used the following code to get the 1st img tag:
Element* needIMG = [document selectElement: #"div.edgeTop div#Group-E img"];
HTML Code trying to parse
<div class="edgeTop">
<div id="Group-E">
<img src="http://example.com/image.jpg" id="image" /> <img src="http://example.com/image2.png" border="5" />
<h4>Group - Section E</h4>
<div class="efs" style="width:28px;">Group:</div>E<br />
<div class="efs" style="width:28px;">Link:</div>Group E<br />
<div class="efs" style="width:28px;">Date:</div><strong>Febuary 15, 2001</strong> by <strong>Date</strong><br />
<br />
<img src="http://example.com/image3.gif" class="image" style="padding: 0 4px 7px 0;" />Group;. <b>Group E</b><br /><br />Group E Other:
<img src="http://example.com/I_need_this_image_here.jpg" /> Other:<br />Group Site
<div class="efs">
<div style="padding:18px 0 1px 8px;">Link Pics:</div>
<img src="http://example.com/linkpic.gif" class="imagelink"/> </div>
</div>
<div class="efsl"></div>
Thanks for the help.
Figured it out after hours of trial and error. You have to use the "+" selector to get the next element.
Could you not add a class to the image you want to parse such as...
<img class="imgtoparse" src="http://example.com/I_need_this_image_here.jpg" />