How to verify the value of the data-qtip of button? - extjs

I'm making an automated test on IE8, and i need to verify the hint of a button, the site I'm automating uses extjs, and for some reason, IE8 and Selenium IDE with the IEDriver don't work very well when it comes to the command "mouseOver". I did the following on Selenium IDE in Firefox and it worked:
<tr>
<td>mouseOver</td>
<td>//span[text()='Relatórios de Retorno']</td>
<td></td>
</tr>
<tr>
<td>waitForVisible</td>
<td>id=ext-quicktips-tip-innerCt</td>
<td></td>
</tr>
<tr>
<td>verifyText</td>
<td>id=ext-quicktips-tip-innerCt</td>
<td>Gera relatórios de retorno</td>
</tr>
But it doesn't work on IE for some reason, even if i stop the Selenium IDE and the driver, and go "manually" with the mouse over the button, the hint don't popup, so i was thinking in try to verify it directly by the data-qtip, but i don't know how.Here's the button code i took with the F12 on IE8, i want to verify the value of the data-tip:
<A aria-disabled=false aria-hidden=false hideFocus style="MARGIN: 0px; TOP: 0px; LEFT: 495px" id=aejs-button-1104 class="x-btn x-unselectable x-box-item x-toolbar-item x-btn-default-toolbar-medium" role=button tabIndex=-1 unselectable="on" data-componentid="aejs-button-1104" data-qtip="Gera relatórios de retorno">

I found the solution with the command "verifyAttribute", here's how i did it:
<tr>
<td>verifyAttribute</td>
<td>id=aejs-button-1104#data-qtip</td>
<td>Gera relatórios de retorno</td>
</tr>

Related

Formatting ng-init text inside input tag - AngularJS

I am having ng-init defined in my input tag. I would like to have this input in the specified format with line breaks.
I tried using <pre> tags and white-space:pre-line property too. But this seems not to get sorted.
<div style="font-family: Poppins !important;-webkit-font-smoothing: antialiased;top:35%; position:absolute; width: 100%; background:transparent !important; margin-bottom:0rem !important">
<input class="form-control"
id="volunteerCallTextId" type="text" placeholder="Volunteer Call Text"
ng-model="volunteerCallText"
ng-init="volunteerCallText ='Hello, may I speak to (Insured). Hi (Mr., Mrs. Etc), my name is _________.
I am with xxx Insurance and am calling you about the recent fire/flood/weather event in_____.
We are calling to check and see if your family is safe and let you know that xxx is here for you.
I want to let you know that we have emergency claims locations set up at: (use locations below).
Or you can call our Claims center at 888....Please be aware that.....'"
style="width: 75em; height:25em; white-space:pre-line" />
</div>
Format expected:
Hello, may I speak to (Insured). Hi (Mr., Mrs. Etc), my name is
_________.
I am with xxx Insurance and am calling you about the recent fire/flood/weather event in_____. We are calling to check and
see if your family is safe and let you know that xxx is here for you.
I want to let you know that we have emergency claims locations set up
at: (use locations below). Or you can call our Claims center at
888....Please be aware that.....
Can someone suggest what could be done?
I am not sure it can be done in input box or not but it works like this in textarea please try and let me know if t helps you
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<body>
<div ng-app="" >
<div style="font-family: Poppins !important;-webkit-font-smoothing: antialiased;top:35%; position:absolute; width: 100%; background:transparent !important; margin-bottom:0rem !important">
<textarea class="form-control"
id="volunteerCallTextId" style="width:75em; height:25em; white-space: pre-wrap;" type="text" placeholder="Volunteer Call Text"
ng-model="volunteerCallText"
ng-init="volunteerCallText ='Hello, may I speak to (Insured). Hi (Mr., Mrs. Etc), my name is _________ \n\
I am with xxx Insurance and am calling you about the recent fire/flood/weather event in_____.\n\
We are calling to check and see if your family is safe and let you know that xxx is here for you.I want to let you know that we have emergency claims locations set up at: (use locations below).Or you can call our Claims center at 888....Please be aware that.....'"
></textarea>
</div>
</div>
</body>
</html>

Selenium Webdriver angular.js button

I have the code which I am trying to run in Selenium webdriver. It is a button but I can't select it with java code. Can you please help me which is true ?
<mat-list-item _ngcontent-c7="" class="menu-item mat-list-item ng-star-inserted" id="kisiler"><div class="mat-list-item-content"><div class="mat-list-item-ripple mat-ripple" mat-ripple=""></div><div class="mat-list-text"></div>
<!----><mat-icon _ngcontent-c7="" class="mat-icon material-icons ng-star-inserted" role="img" aria-hidden="true">group</mat-icon>
<!---->
<!----><mat-label _ngcontent-c7="" class="ng-star-inserted">Kişiler</mat-label>
</div></mat-list-item>
My code is:
driver.findElement(By.id("[#id='kisiler']")).click();
To click on the element with text as Kisiler you need to induce WebDriverWait for the element to be clickable and you can use the following solution:
xpath:
new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.xpath("//mat-list-item[#class='menu-item mat-list-item ng-star-inserted' and #id='kisiler']//mat-label[#class='ng-star-inserted']"))).click();

selenium web driver download big version of images

some websites like digikey, for img tag has two source(small version and big version) :
<img itemprop="image" class="pszoomer" zoomimg="//media.digikey.com/Renders/STMicro%20Renders/497;144LQFP-1.6-20x20;144.jpg" border="0" height="64" src="//media.digikey.com/Renders/STMicro%20Renders/497;144LQFP-1.6-20x20;144_tmb.jpg" alt="STM32F407ZET6 - STMicroelectronics" title="STM32F407ZET6 - STMicroelectronics">
I want to download image link in zoomimg attribute , any suggestion ?

ng-show > 10 throws syntax error (VS browser link)

I have a table cell that shows if there's more than 10 records. Part of my pagination.
<td ng-show="totalRecords>10" colspan="5">
<ul uib-pagination style="margin:0;" total-items="totalRecords" ng-model="currentPage" ng-change="pageChanged()"></ul>
</td>
Pretty straightforward. But here's the crazy - it throws the following error in Chrome:
Uncaught Error: Syntax error, unrecognized expression: td[ng-show='totalRecords # browserLink:37
bc.error # browserLink:37
bh # browserLink:37
bp # browserLink:37
...etc
I'll note that $scope.totalRecords is set to zero (0) in the controller. Setting it to other values doesn't change anything. Everything else in the controller works perfectly.
The following scenarios don't throw any error:
<td ng-show="totalRecords=10" colspan="5">...</td>
<td ng-show="totalRecords<10" colspan="5">...</td>
<td ng-show="totalRecords>9" colspan="5">...</td>
<td ng-show="totalRecords>=11" colspan="5">...</td>
<td ng-show="totalRecords" colspan="5">...</td>
Anyone have a guess as to why?
The problem is with Visual Studio's "browser link" feature which can cause problems with AngularJS. Based on some research I did about the error you are experiencing, it seems that people are recommending to disable the browser link feature in Visual Studio.
http://connect.microsoft.com/VisualStudio/feedbackdetail/view/814546/browserlink-throws-an-exception-when-using-angularjs-and-binding-in-an-attribute-browserlink-does-not-like-in-a-html-attribute
The following link includes a similar description of the error you have and a few ways to disable the browser link feature:
http://www.telerik.com/forums/the-new-browser-link-feature-in-vs-2013-is-causing-an-error-when-detailtable-of-hierarchy-radgrid-is-expanded

How to find xpath from javascript href

The scenario is I need to check all the by default elements present on a web page. I am trying to check the headers available on a web table.
I am able to find all headers except one whose name is IP Address / Host Name
<div id="ctl00_ContentPlaceHolder1_RadGrid1_GridHeader" class="rgHeaderDiv" style="overflow: hidden;">
<table id="ctl00_ContentPlaceHolder1_RadGrid1_ctl00_Header" class="rgMasterTable rgClipCells rgClipCells" style="border-color:#6788BE;border-width:1px;border-style:solid;width:100%;table-layout:fixed;overflow:hidden;empty-cells:show;">
<colgroup>
<thead>
<tr>
<th class="rgHeader rgSorted" style="font-weight:bold;font-style:normal;text-decoration:none;text-align:left;" scope="col">
IP Address / Host Name
<input class="rgSortAsc" type="button" title="Sorted asc" onclick="javascript:__doPostBack('ctl00$ContentPlaceHolder1$RadGrid1$ctl00$ctl02$ctl01$ctl06','')" value=" " name="ctl00$ContentPlaceHolder1$RadGrid1$ctl00$ctl02$ctl01$ctl06">
</th>
</tr>
</thead>
<tbody style="display:none;">
</table>
</div>
I tried finding using below codes but failed to do so.
driver.findElement(By.xpath("//div[#id='ctl00_ContentPlaceHolder1_RadGrid1_GridHeader']//a[contains(#href,'IP Address / Host Name')]"));
driver.findElement(By.xpath("//a[contains(#href,'IP Address')]"));
driver.findElement(By.linkText(IP Address / Host Name));
I tried with changing div id and its value ti table id and corresponding value too but script fail saying not able to find element with xpath...
My script always says failed to find element with id... or xpath...
Please help.
If you're having trouble accessing the element programmatically, my advice would be to use the Selenium IDE to select the element, then export the test case by going to File > Export Test Case As... > Java / JUnit 4 / WebDriver.
I tried this myself and the resulting code uses:
driver.findElement(By.linkText("IP Address / Host Name"))
It seems to work fine in the Selenium IDE. I haven't tested the resulting Java code. - From your syntax, it appears you're using Java.
You say you've tried using By.linkText(), so maybe there's a bigger problem? (I notice you don't have quotes around your By.linkText() example, but I assume this is a typo.)

Resources