Jsoup - Parsing a HTML file with charset iso-8859-1 - java

I am having trouble with special characters and charset = iso-8859-1.
The same code that I use here works fine with UTF-8, so I do not understand what I am doing wrong.
Here is the code:
File input = new File("/users/marcioapf/example.html");
Document doc = Jsoup.parse(input, "iso-8859-1", "");
Elements elements = doc.select("span.DEPUTADO") ;
System.out.println(elements.toString());
Here is the output:
<span style="margin-left: 8px; width: auto !important;" class="DEPUTADO">Joãozinho Pereira</span>
<span style="margin-left: 8px; width: auto !important;" class="DEPUTADO">Isnaldo Bulhões</span>
<span style="margin-left: 8px; width: auto !important;" class="DEPUTADO">Antonio Albuquerque</span>
<span style="margin-left: 8px; width: auto !important;" class="DEPUTADO">Jeferson Morais</span>
<span style="margin-left: 8px; width: auto !important;" class="DEPUTADO">Inácio Loiola</span>
Here is how it should be:
<span style="margin-left: 8px; width: auto !important;" class="DEPUTADO">Joãozinho Pereira</span>
<span style="margin-left: 8px; width: auto !important;" class="DEPUTADO">Isnaldo Bulhões</span>
<span style="margin-left: 8px; width: auto !important;" class="DEPUTADO">Antonio Albuquerque</span>
<span style="margin-left: 8px; width: auto !important;" class="DEPUTADO">Jeferson Morais</span>
<span style="margin-left: 8px; width: auto !important;" class="DEPUTADO">Inácio Loiola</span>
How I can I fix it?

Using EscapeMode.xhtml will give you output without entities.
Try this code
File input = new File("/users/marcioapf/example.html");
Document doc = Jsoup.parse(input, "iso-8859-1", "");
doc.outputSettings().escapeMode(EscapeMode.xhtml);
Elements elements = doc.select("span.DEPUTADO") ;
System.out.println(elements.toString());

Related

handle a dynamically changing element and a scroll bar

This is a screen shot of my webpage
Here is the html code
<div class="slimScrollDiv" style="position: relative; overflow: hidden; width: auto; height: 350px;"><div class="scroller" style="height: 350px; overflow: hidden; width: auto;" data-always-visible="1" data-rail-visible1="0" data-handle-color="#D7DCE2">
<div class="tsk-row clearfix">
<div class="tsk-left">
New task to check new build of 2016.4.18.1
</div>
test
<div class="tsk-right">
<span class="label label-warning">Assigned</span>
</div>
</div>
<div class="tsk-row clearfix">
<div class="tsk-left">
test 2
</div>
test
<div class="tsk-right">
<span class="label label-warning">Assigned</span>
</div>
</div>
<div class="tsk-row clearfix">
<div class="tsk-left">
test
</div>
test
<div class="tsk-right">
<span class="label label-warning">Assigned</span>
</div>
</div>
<div class="tsk-row clearfix">
<div class="tsk-left">
New login page
</div>
test
<div class="tsk-right">
<span class="label label-warning">Assigned</span>
</div>
</div>
<div class="tsk-row clearfix">
<div class="tsk-left">
new task
</div>
Ongoing
<div class="tsk-right">
<span class="label label-warning">Assigned</span>
</div>
</div>
<div class="tsk-row clearfix">
<div class="tsk-left">
This is testing
</div>
test
<div class="tsk-right">
<span class="label label-warning">Assigned</span>
</div>
</div>
</div>
</div><div class="slimScrollBar" style="width: 7px; position: absolute; top: 0px; opacity: 0.4; display: none; border-radius: 7px; z-index: 99; right: 0px; height: 300.245px; background: rgb(0, 0, 0);"></div><div class="slimScrollRail" style="width: 7px; height: 100%; position: absolute; top: 0px; display: none; border-radius: 7px; opacity: 0.2; z-index: 90; right: 0px; background: rgb(51, 51, 51);"></div></div>
Here is my automation test case
public void openAllTask() throws InterruptedException{
List<WebElement> task=driver.findElements(By.cssSelector(".tsk-row.clearfix")); // get the list of total no of elements present in the task window
System.out.println("size of i loop "+task.size());
for(int i=1; i<=task.size(); i++){
//find the element one by one using xpath
System.out.println(driver.findElement(By.xpath("html/body/div[2]/div[3]/div/div/div/div[3]/div/div[1]/div["+i+"]/div[1]/a")).getText());
driver.findElement(By.xpath("html/body/div[2]/div[3]/div/div/div/div[3]/div/div[1]/div["+i+"]/div[1]/a")).click();
Thread.sleep(3000);
driver.navigate().back();
Thread.sleep(3000);
// find the scroll bar and move the scroll bar by cirten pixles
WebElement element=driver.findElement(By.xpath("html/body/div[2]/div[3]/div/div/div/div[3]/div/div[2]"));
Actions act=new Actions(driver);
act.dragAndDropBy(element, 0, (i*10)).build().perform();
Thread.sleep(3000);
}
I want to select each element from the window which is highlighted and also scroll the window down so that when dynamically elements are added then I can scroll down and read all the elements.
Try like below:
//i am not sure about my css path is correct or not as no way to check it
// if it prints the text and size correctly, than it will fine but if not than please give the right css path.
List<WebElement> elements = driver.findElements(By.cssSelector(".tsk-row.clearfix > div.tsk-left> a");
System.out.println("size is "+elements.size());
for(int i = 0; i < elements.size(); i++){
JavascriptExecutor js = (JavascriptExecutor)driver;
WebElement elem = elements.get(i);
//this line will scroll down to make element visible
js.executeScript("window.scrollTo(" + elem.getLocation().x + "," +(elem.getLocation().y- 100) + ");");
//don't use this kind of wait, use explicit wait
Thread.sleep(1000);
System.out.println(elem.getText());
elem.click();
Thread.sleep(3000);
driver.navigate().back();
Thread.sleep(3000);
}

Upload file webdriver sendKey with no ID field

Hi I was wondering if i could use this command when there is no ID field, it seems like the button accepts input. I tried .sendKeys but it doesn't seem to do anything, places said don't use the .click(); command after.
Here is the html for the button.
<button class="md-button-icon mt-toolbar-button md-button md-default-theme ng-pristine ng-untouched ng-valid" accept="image/*" ng-model="chatFiles" ng-disabled="!sessionStarted" ng-show="!chatMessage" ng-file-select="" tabindex="0" style="overflow: hidden;" aria-hidden="false" aria-invalid="false" aria-disabled="false">
<mt-icon class="ng-isolate-scope" height="24" width="24" icon=" attachment" style="width: 24px; height: 24px;">
<span>menu</span>
<input type="file" accept="image/*" style="width: 1px; height: 1px; opacity: 0; position: absolute; padding: 0px; margin: 0px; overflow: hidden;" tabindex="-1" ng-file-generated-elem="true">
</button>
This is my code in webdriver:
wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("/html/body/div[2]/div/md-card/md-content/div/div[2]/button[2]")));
WebElement Upload = driver.findElement(By.xpath("/html/body/div[2]/div/md-card/md-content/div/div[2]/button[2]"));
Upload.sendKeys("C:/Users/elsid/Desktop/Eclipse/Workspace/NG - Mentored/Autoit/test.png");
This is the code from the uploaded image all the way down to the button again.
<li class="ng-scope mt-chat-mine" layout="row" ng-class="{ 'mt-chat-mine': message.isMine()}" ng-repeat="message in messages">
<!--
ngIf: !message.isMine()
-->
<!--
ngIf: message.type == 1
-->
<!--
ngIf: message.type == 2
-->
<img class="chat-image ng-scope" ng-if="message.type == 2" ng-src="http://mentoredapp.perrysysdev.com/usercontent/SessionFiles/8040eeaa-3584-4a13-b54e-a16bfadd6433.jpg" src="http://mentoredapp.perrysysdev.com/usercontent/SessionFiles/8040eeaa-3584-4a13-b54e-a16bfadd6433.jpg"></img>
<!--
end ngIf: message.type == 2
-->
<!--
ngIf: message.type == 3
-->
<!--
ngIf: message.isMine()
-->
<img class="avatar ng-scope" ng-if="message.isMine()" ng-src="http://mentoredapp.perrysysdev.com/usercontent/TutorProfilePictures/25f586a2-5031-49a5-94a3-e65305faed8a.png" src="http://mentoredapp.perrysysdev.com/usercontent/TutorProfilePictures/25f586a2-5031-49a5-94a3-e65305faed8a.png"></img>
<!--
end ngIf: message.isMine()
-->
</li>
<!--
end ngRepeat: message in messages
-->
</ul>
<div class="text-box" layout="row">
<textarea id="chat-message-box" class="message-box ng-pristine ng-untouched ng-valid" placeholder="Send a message.." ng-disabled="!sessionStarted" mt-enter="sendChatMessage()" flex="" ng-model="chatMessage" aria-multiline="true" tabindex="0" aria-invalid="false" aria-disabled="false"></textarea>
<button class="md-button-icon mt-toolbar-button md-button md-default-theme ng-hide" ng-transclude="" ng-show="chatMessage" ng-disabled="!chatMessage" ng-click="sendChatMessage()" tabindex="0" aria-hidden="true" aria-disabled="true" disabled="disabled"></button>
<button class="md-button-icon mt-toolbar-button md-button md-default-theme ng-valid ng-dirty ng-valid-parse ng-touched" accept="image/*" ng-model="chatFiles" ng-disabled="!sessionStarted" ng-show="!chatMessage" ng-file-select="" ng-click="clicked" tabindex="0" style="overflow: hidden;" aria-hidden="false" aria-invalid="false" aria-disabled="false">
<mt-icon class="ng-isolate-scope" height="24" width="24" icon=" attachment" style="width: 24px; height: 24px;"></mt-icon>
<span></span>
<input type="file" accept="image/*" style="width: 1px; height: 1px; opacity: 0; position: absolute; padding: 0px; margin: 0px; overflow: hidden;" tabindex="-1" ng-file-generated-elem="true"></input>
</button>
You can simplify the xpath little bit more to find the element easily
By xpath = By.xpath("//span[text()='menu']");
By fileTag = By.cssSelector("[type='file']");
wait.until(ExpectedConditions.presenceOfElementLocated(xpath)));
WebElement Upload = driver.findElement(fileTag);
Upload.sendKeys("C:/Users/elsid/Desktop/Eclipse/Workspace/NG - Mentored/Autoit/test.png");
If the file input is hidden only way to handle that is JavaScript and set the attribute. Try the following code
String filePath = "C:/Users/elsid/Desktop/Eclipse/Workspace/NG - Mentored/Autoit/test.png";
String script = "document.querySelector(\"[type='file']\").setAttribute('value','" + filePath + "');";
((JavascriptExecutor)driver).executeScript(script);
I assumed that's the only file input tag on that page and not hidden. If not you may have to adjust the file selector

Get text from textbox with up and down arrows in Selenium Webdriver

I have a textbox in the footer of the pagination table. This textbox contains a textbox with up and down arrows as shown in the below Image. This textbox values will dynamically changed when we click on next, previous buttons.
Image URL: http://i.msdn.microsoft.com/dynimg/IC1380.jpg
This is the input from DOM
<div ng-grid-footer="" class="ng-scope"><div ng-show="showFooter" class="ngFooterPanel ng-scope ui-widget-content ui-corner-bottom" ng-class="{'ui-widget-content': jqueryUITheme, 'ui-corner-bottom': jqueryUITheme}" ng-style="footerStyle()" style="width: 1920px; height: 55px;">
<div class="ngTotalSelectContainer">
<div class="ngFooterTotalItems ngNoMultiSelect" ng-class="{'ngNoMultiSelect': !multiSelect}" style="margin-top: 8px">
<span class="ngLabel ng-binding">Total Items: 810</span><span ng-show="filterText.length > 0" class="ngLabel ng-binding ng-hide">(Showing Items: 100)</span>
</div>
<div class="ngFooterSelectedItems ng-hide" ng-show="multiSelect">
<span class="ngLabel ng-binding">Selected Items: 0</span>
</div>
</div>
<div class="ngPagerContainer ngNoMultiSelect" style="float: right; margin-top: 10px" ng-show="enablePaging" ng-class="{'ngNoMultiSelect': !multiSelect}">
<div style="float:left; margin-right: 10px" class="ngRowCountPicker">
<span style="float: left; margin-top: 8px" class="ngLabel ng-binding">Page Size:</span>
<select style="float: left;height: 29px; width: 100px" ng-model="pagingOptions.pageSize" class="ng-valid ng-dirty">
<!-- ngRepeat: size in pagingOptions.pageSizes --><option ng-repeat="size in pagingOptions.pageSizes" class="ng-scope ng-binding" value="10">10</option><!-- end ngRepeat: size in pagingOptions.pageSizes --><option ng-repeat="size in pagingOptions.pageSizes" class="ng-scope ng-binding" value="25">25</option><!-- end ngRepeat: size in pagingOptions.pageSizes --><option ng-repeat="size in pagingOptions.pageSizes" class="ng-scope ng-binding" value="50">50</option><!-- end ngRepeat: size in pagingOptions.pageSizes --><option ng-repeat="size in pagingOptions.pageSizes" class="ng-scope ng-binding" value="100">100</option><!-- end ngRepeat: size in pagingOptions.pageSizes -->
</select>
</div>
<div style="float:left; margin-right: 10px; line-height:25px" class="ngPagerControl">
<button class="ngPagerButton" ng-click="pageToFirst()" ng-disabled="cantPageBackward()" title="First Page"><div class="ngPagerFirstTriangle"><div class="ngPagerFirstBar"></div></div></button>
<button class="ngPagerButton" ng-click="pageBackward()" ng-disabled="cantPageBackward()" title="Previous Page"><div class="ngPagerFirstTriangle ngPagerPrevTriangle"></div></button>
<!--Input Textbox Which I want to Inspect -->
<input class="ngPagerCurrent ng-valid-number ng-valid-min ng-valid ng-valid-max ng-dirty" min="1" max="9" type="number" style="width:50px; height: 26px; margin-top: 1px; padding: 0 4px" ng-model="pagingOptions.currentPage">
<!--END-->
<button class="ngPagerButton" ng-click="pageForward()" ng-disabled="cantPageForward()" title="Next Page"><div class="ngPagerLastTriangle ngPagerNextTriangle"></div></button>
<button class="ngPagerButton" ng-click="pageToLast()" ng-disabled="cantPageToLast()" title="Last Page"><div class="ngPagerLastTriangle"><div class="ngPagerLastBar"></div></div></button>
<button ng-controller="OmniSearchViewCtrl" id="page-summary-help-button" title="Help" class="ngPagerButton ng-scope" ng-click="handlePageSummaryHelpButtonClick()">
<span class="ptipsicon ptipsicon-help" style="padding:0 6px; float:left"></span>
</button>
</div>
</div>
This is Xpath
//*[#id="PageViewContainer"]/div/div[3]/div/div[2]/div[2]/input
My problem is, I am unable to get the values from the textbox since the textbox doesn't have any attribute:value. I have tried using the below lines to get the text but it just displays a blank. However, I didn't get any exceptions
pageNumber = findElement(By.xpath(properties.getString("PageNumber"))).getText();
pageNumber = findElement(By.xpath(properties.getString("PageNumber"))).getAttribute("value");
Whereas, when I tried this I am getting no such element found exception.
pageNumber = findElement(By.xpath("//input[#id=\"PageViewContainer\"]"))).getText();
Any help would be much appreciated.
//*[#id="PageViewContainer"]
Your xpath begins with a search for an element with an id="PageViewContainer". There is no such element in your HTML, so your xpath returns nothing.
Based on the snippet you have given, you can find the input element by:
//div[#class='ngPagerControl']/input
You can then use the getText() method to extract the text value.

Is there any API or website that could colorcode my Java codes and transform it into html?

I have a piece of Java code that I want to post on my website.
The code looks like this:
class Integers {
public static void main(String[] arguments) {
int c; //declaring a variable
/* Using for loop to repeat instruction execution */
for (c = 1; c <= 10; c++) {
System.out.println(c);
}
}
}
In order to transform it into a good looking HTML and post it on my website i need to write the following:
<div class="geshifilter">
<pre class="java geshifilter-java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> Integers <span style="color: #009900;">{</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">(</span><span style="color: #003399;">String</span><span style="color: #009900;">[</span><span style="color: #009900;">]</span> arguments<span style="color: #009900;">)</span> <span style="color: #009900;">{</span>
<span style="color: #000066; font-weight: bold;">int</span> c<span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//declaring a variable</span>
<span style="color: #666666; font-style: italic;">/* Using for loop to repeat instruction execution */</span>
<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">(</span>c <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> c <span style="color: #339933;"><=</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">;</span> c<span style="color: #339933;">++</span><span style="color: #009900;">)</span> <span style="color: #009900;">{</span>
<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">(</span>c<span style="color: #009900;">)</span><span style="color: #339933;">;</span>
<span style="color: #009900;">}</span>
<span style="color: #009900;">}</span>
<span style="color: #009900;">}</span></pre></div>
There is too much hassle doing this. Is there any easier way?
I use SyntaxHighlighter. It should do exactly what you are looking for: http://alexgorbatchev.com/SyntaxHighlighter/
Put all your code within <pre class="prettyprint"> or <code class="prettyprint"> elements and add the google-code-prettify JavaScript plugin to your webpage. Here is the link to the tutorial:
http://google-code-prettify.googlecode.com/svn/trunk/README.html

WebElement getText() returning empty string even though element is visible

I'm having a hard time retrieving the text of an element, for some reason WebDriver can find the element but it can't retrieve the text, I'm suspecting because for some reason the element is not visible to WebDriver, I'll get to that in a moment.
Here's a snippet of the HTML:
<td id="x-auto-4169" class="x-grid3-col x-grid3-cell x-grid3-td-badCalls " style="width:53px;" role="gridcell">
<div class="x-grid3-cell-inner x-grid3-col-badCalls" unselectable="on">0</div>
</td>
The Xpath to get to this is
String valueXpath = "((//div[#id=\"QosDashpardPanelBottom\"]//div[#id=\"CollectorQoSPerformanceMetricsgrid\"]//div[contains(#class, \"x-grid3-row x-unselectable-single\")])[" + j + "]//div)[" + i + "]";
WebElement value = driver.findElement(By.xpath(valueXpath));
Where 'j' is the row number and 'i' is the column number respectively in a table/grid. I know that Selenium can find the element because I can do
WebElement class = driver.findElement(By.xpath(fullXpath));
String classAttr = arg.getAttribute("class");
and I return
x-grid3-cell-inner x-grid3-col-badCalls
but when I try
String cellValue = value.getText();
System.out.println(cellValue);
I get an empty string. I'm staring at my computer screen and I can see the value, it's visible, I know Selenium finds the element but I can't retrieve the text. Interestingly someone suggested to first click on the value then try to getText() so when I tried to click I got the exception:
org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with
So I'm wondering if I'm not able to retrieve the text value because it's not visible? However if that's the case it seems strange that I can retrieve things like class attribute, tags, etc but not the text value.
Any suggestions would be greatly appreciated.
HTML:
<body class=" ext-gecko ext-windows" onload="processLoaders();">
<script type="text/javascript">
<div id="topNavDiv" style="height: 90px">
<div id="bodyContentOuter" style="width: 1280px; height: 587px;">
<div id="bodyContentInner">
<script src="RLT/RLT.nocache.js" language="javascript" type="text/javascript">
<script defer="defer">
<script language="javascript" type="text/javascript">
<div id="rtcpMain" class=" x-component x-border-layout-ct" style="width: 1280px; height: 587px;">
<div id="rtcpMainWest" class=" x-panel x-component x-border-panel" style="left: 5px; top: 5px; width: 225px;">
<div id="x-auto-2" class=" x-tab-panel x-component x-border-panel" tabindex="0" hidefocus="true" style="left: 235px; top: 5px; width: 1040px;">
<div class="x-tab-panel-header x-unselectable" style="width: 1038px;" unselectable="on">
<div class="tone-rtcp-tabbed-content-panel" style="width: 1040px; height: 550px;">
<div id="x-auto-10" class=" x-component" style="overflow: auto; width: 1040px; height: 550px;">
<div id="QosDashboardPanel0" class=" x-panel x-component" style="width: 1040px;">
<div id="x-auto-13" class=" x-small-editor x-panel-header x-component x-hide-display" role="presentation">
<div id="rtcpDPBWrap" class="x-panel-bwrap" role="presentation" style="overflow: visible;">
<div class="x-panel-tbar x-panel-tbar-noheader" role="presentation" style="width: 1040px;">
<div id="rtcpDPBody" class="x-panel-body x-panel-body-noheader x-border-layout-ct" role="presentation" style="width: 1038px; height: 700px;">
<div id="QosDashboardPanelTop" class=" x-component x-border-panel x-border-layout-ct" style="left: 0px; top: 0px; width: 1038px; height: 400px;">
<div id="QosDashpardPanelBottom" class=" x-component x-border-panel x-border-layout-ct" style="left: 1px; top: 401px; width: 1036px; height: 298px;">
<div id="QosDashpardPanel_pqosChartsLC" class=" x-component x-border-panel x-border-layout-ct x-hide-display" style="left: 0px; top: 0px; width: 1036px; height: 400px;">
<div id="QosDashpardPanel_metricsTablesLC" class=" x-component x-border-panel x-border-layout-ct" style="left: 1px; top: 1px; width: 1034px; height: 296px;">
<div id="CollectorMetrics_toneletWrapper" class=" x-panel x-component x-border-panel" style="left: 1px; top: 1px; width: 330px;">
<div id="x-auto-99" class=" x-small-editor x-panel-header x-component x-hide-display" role="presentation">
<div class="x-panel-bwrap" role="presentation">
<div class="x-panel-body x-panel-body-noheader" role="presentation" style="width: 328px; height: 292px;">
<div id="CollectorMetrics" class=" x-panel x-component" style="width: 328px;">
<div id="x-auto-109" class=" x-small-editor x-panel-header x-component x-unselectable" role="presentation" unselectable="on">
<div class="x-panel-bwrap" role="presentation">
<div class="x-panel-body" role="presentation" style="width: 326px; height: 265px;">
<div id="CollectorQoSPerformanceMetricsgrid" class=" x-grid-panel x-component" style="position: relative; width: 326px; height: 265px;" tabindex="0" hidefocus="true" unselectable="">
<div class="x-grid3" role="presentation" style="width: 326px; height: 265px;">
<div class="x-grid3-viewport" role="presentation">
<div class="x-grid3-header" role="presentation">
<div class="x-grid3-scroller" role="presentation" style="width: 326px; height: 243px;">
<div class="x-grid3-body" role="presentation">
<div id="CollectorQoSPerformanceMetricsgrid_x-auto-633" class="x-grid3-row x-unselectable-single x-grid3-row-selected x-grid3-highlightrow " style="width:510px;">
<table class="x-grid3-row-table" cellspacing="0" cellpadding="0" border="0" style="width:510px;" role="presentation">
<tbody role="presentation">
<tr role="presentation">
<td id="x-auto-634" class="x-grid3-col x-grid3-cell x-grid3-td-name x-grid-cell-first " style="width:148px;" role="gridcell">
<div class="x-grid3-cell-inner x-grid3-col-name" unselectable="on">
<u>Lync</u>
</div>
</td>
<td id="x-auto-635" class="x-grid3-col x-grid3-cell x-grid3-td-badCalls " style="width:53px;" role="gridcell">
<div class="x-grid3-cell-inner x-grid3-col-badCalls" unselectable="on">36</div>
</td>
<td id="x-auto-636" class="x-grid3-col x-grid3-cell x-grid3-td-totalCalls " style="width:58px;" role="gridcell">
<div class="x-grid3-cell-inner x-grid3-col-totalCalls" unselectable="on">120</div>
</td>
<td id="x-auto-637" class="x-grid3-col x-grid3-cell x-grid3-td-avgLatency " style="width:73px;" role="gridcell">
<div class="x-grid3-cell-inner x-grid3-col-avgLatency" unselectable="on">223</div>
</td>
<td id="x-auto-638" class="x-grid3-col x-grid3-cell x-grid3-td-avgLoss " style="width:53px;" role="gridcell">
<div class="x-grid3-cell-inner x-grid3-col-avgLoss" unselectable="on">0.80</div>
</td>
<td id="x-auto-639" class="x-grid3-col x-grid3-cell x-grid3-td-avgJitter " style="width:58px;" role="gridcell">
<div class="x-grid3-cell-inner x-grid3-col-avgJitter" unselectable="on">29</div>
</td>
<td id="x-auto-640" class="x-grid3-col x-grid3-cell x-grid3-td-avgMOS x-grid3-cell-last " style="width:53px;" role="gridcell">
<div class="x-grid3-cell-inner x-grid3-col-avgMOS" unselectable="on">3.86</div>
</td>
</tr>
</tbody>
</table>
</div>
<div id="CollectorQoSPerformanceMetricsgrid_x-auto-641" class="x-grid3-row x-unselectable-single " style="width:510px;">
<table class="x-grid3-row-table" cellspacing="0" cellpadding="0" border="0" style="width:510px;" role="presentation">
<tbody role="presentation">
<tr role="presentation">
<td id="x-auto-642" class="x-grid3-col x-grid3-cell x-grid3-td-name x-grid-cell-first " style="width:148px;" role="gridcell">
<div class="x-grid3-cell-inner x-grid3-col-name" unselectable="on">
<u>CUCM-Publisher</u>
</div>
</td>
<td id="x-auto-643" class="x-grid3-col x-grid3-cell x-grid3-td-badCalls " style="width:53px;" role="gridcell">
<div class="x-grid3-cell-inner x-grid3-col-badCalls" unselectable="on">3</div>
</td>
<td id="x-auto-644" class="x-grid3-col x-grid3-cell x-grid3-td-totalCalls " style="width:58px;" role="gridcell">
<div class="x-grid3-cell-inner x-grid3-col-totalCalls" unselectable="on">52</div>
</td>
<td id="x-auto-645" class="x-grid3-col x-grid3-cell x-grid3-td-avgLatency " style="width:73px;" role="gridcell">
<div class="x-grid3-cell-inner x-grid3-col-avgLatency" unselectable="on">190</div>
</td>
<td id="x-auto-646" class="x-grid3-col x-grid3-cell x-grid3-td-avgLoss " style="width:53px;" role="gridcell">
<div class="x-grid3-cell-inner x-grid3-col-avgLoss" unselectable="on">0.79</div>
</td>
<td id="x-auto-647" class="x-grid3-col x-grid3-cell x-grid3-td-avgJitter " style="width:58px;" role="gridcell">
<div class="x-grid3-cell-inner x-grid3-col-avgJitter" unselectable="on">31</div>
</td>
<td id="x-auto-648" class="x-grid3-col x-grid3-cell x-grid3-td-avgMOS x-grid3-cell-last " style="width:53px;" role="gridcell">
<div class="x-grid3-cell-inner x-grid3-col-avgMOS" unselectable="on">3.98</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
After much (much) troubleshooting it turned out that I had a slight mistake on my Xpath. From my html
<div id="QosDashboardPanel0" ...
I was not accounting for multiple tabs. In my AUT I was opening a new tab, not a new browser tab but a tab in the application itself, and the whole Hmtl would remain the same except the snippet above would change to
<div id="QosDashboardPanel1" ...
I was assuming that the ID wouldn't change, well lesson learned! This is why I was running into the 'not able to click an invisible element', the element was in fact there but it was hidden behind my active tab.
Not much of a solution but I hope if someone is running into something similar this at least points them in the correct direction or makes a bell go off.

Categories