Need to select rows from Web Table - selenium

I have a web table, which is showing some data based on some search filter criteria. So in actual we have total-50 rows. But after applying filter only 1 is visible on the table.
Here the problem is, in DOM it's showing all 50 rows including that 1 which is visible.
<table-row style="height: 32px; line-height: 32px; transform: translateY(0px);">
<table-row style="height: 12px; line-height: 12px; transform: translateY(32px); display:none;">
<table-row style="height: 12px; line-height: 12px; transform: translateY(38px); display:none;">
<table-row style="height: 12px; line-height: 12px; transform: translateY(41px); display:none;">
Now the only option i have is to use this display part of attribute-"style"I As i want only those rows, which doesn't contain this display option none in their style attribute am trying a xpath like-
below but it's not working`
//table-row[not(contains(#style,'%display: none%')]

You need to remove those leading and trailing % symbols and add closing bracket:
//table-row[not(contains(#style,'display:none;'))]

Related

How to allow wordwrap for labels in tab-bar (QTabbar) in qpdfview?

I have documents with long titles and would like them to appear with its full name in the tabbar in qpdfview.
I researched a lot and found that QT has the functionality to allow stylesheet. I looked in the documentation and found no propriety that allows word wrap for title names of the pdf files.
The stylesheet are located in ~/.config/qpdfview/qpdfview.conf, under [mainWindow] I put
styleSheet="QTabBar::tab { font-size: 12px; margin: 0px; padding: 0px; border: 1px; max-width: 120px; }\nQTabBar::tab:selected, QTabBar::tab:hover { font-size: 12px; background-color: coral; min-height: 24px; titlebar-show-tooltips-on-buttons: true; text-align: right; }"
I'm looking for something that is impossible? Then I have to try to change what are shown in the label of the tabbar.

How to stop/handle random HTML popup during test execution - Selenium Webdriver

I'm hoping someone would be able to help me with my query. I've done quite a bit of research online and haven't found any particular solution to it yet.
While running my test case, I sometimes encounter an HTML popup that I'm unable to handle in my script. It is very random (well based on customer behaviour while they are traversing the site) and can popup at any time during the customer journey. Sometimes it doesn't popup at all. When it appears only then an entry is visible inside the DOM.
Basically, it is a livechat window (LivePerson to be precise) suggesting customers that an agent is available to help them complete their order if they wish to do so.
Here is a screenshot:
popup screenshot
The below is available in Firebug when I inspect the element:
<div id="LPMcontainer-1483053256847-0" class="LPMcontainer LPMoverlay" style="margin: -143px 0px 0px -285px; padding: 0px; border-style: solid; border-width: 0px; outline-color: rgb(106, 159, 177); outline-width: 2px; font-style: normal; font-weight: normal; font-variant: normal; list-style: outside none none; letter-spacing: normal; line-height: normal; text-decoration: none; vertical-align: baseline; white-space: normal; word-spacing: normal; background-repeat: repeat-x; background-position: left bottom; background-color: transparent; border-color: transparent; width: 571px; height: 287px; cursor: pointer; display: block; z-index: 107158; position: fixed; top: 50%; bottom: auto; left: 50%; right: auto;">
<div role="button" tabindex="0"><img src="https://www./content/dam/tcom/apps/live-person/live-person-chat-bundles-top.jpg" id="LPMimage-1483053256849-2" alt="" class="LPMimage" style="margin: 0px; padding: 0px; border-style: none; border-width: 0px; outline-color: rgb(106, 159, 177); outline-width: 2px; font-style: normal; font-weight: normal; font-variant: normal; list-style: outside none none; letter-spacing: normal; line-height: normal; text-decoration: none; vertical-align: baseline; white-space: normal; word-spacing: normal; position: absolute; z-index: 600; left: 0px; top: 0px;">
</div>
<img src="https://www./content/dam/tcom/apps/live-person/live-person-chat-bottom.jpg" id="LPMcloseButton-1483053256847-1" alt="" class="LPMcloseButton" style="margin: 0px; padding: 0px; border-style: none; border-width: 0px; outline-color: rgb(106, 159, 177); outline-width: 2px; font-style: normal; font-weight: normal; font-variant: normal; list-style: outside none none; letter-spacing: normal; line-height: normal; text-decoration: none; vertical-align: baseline; white-space: normal; word-spacing: normal; position: absolute; cursor: pointer; z-index: 9999; left: 0px; top: 194px;" data-lp-event="close" role="button" tabindex="0">
</div>
It appears in all browsers.
I'd like to handle it in either of the following ways:
Stop it from loading at all (again due to random nature ).
OR
While the script is being executed, as soon as the window appears, it presses 'No thanks' button (id="LPMcloseButton-1483053256847-1" in the above code) and then continue executing the rest of the steps. Please note that id is dynamic in nature, i.e it's unique every time.
Your help would be highly appreciated.
It may not be random. Some sites that I write automation for have something like this also. After some investigation I found that the dialog always popped up after 30 seconds... it just seemed random because I could be on any page when the 30s was up. After more investigation I found that the site looked for a cookie and if it wasn't found, the dialog would be triggered. I found the cookie that was created after the dialog was closed and created it at the start of the script so that it would no longer open.
I would suggest that you look for an existing cookie that was created for that site and see what's in it. Then browse to the site, wait for the dialog to pop up, and close it. See what changes... if the cookie changes or a new cookie is added, etc. then just mimic that behavior before browsing the site.
NOTE: In my case, I had to intentionally browse to a missing page on the domain, e.g. somesite.com/someerrorpage, to create the cookie without the timer starting. Then I just navigated to the site and continued the script.
I'd say the easiest way to get around this is to create a webdriver wrapper that for every call you would send to webdriver, first check if the dialog is present. If it's present, close it, otherwise send the action over to webdriver.

Getting phantomjs 1.9.8 to render borders round HTML table cells in PDF correctly

Rendering a table, with boarders, to PDF using phantomjs leaves each individual cell bordered but with a gap between each cell. The table is displayed correctly, without such gaps, on a web page.
in my CSS I've tried setting:
border-collapse: collapse;
border-spacing: 0px 0px;
to no avail, I need to get rid of those gaps between cells in my PDF.
Any ideas would be gratefully received.
Yours Allan
Be sure to add the border-spacing and border-collapse rules to the <table> and not the <td>. This is my phantomjs-specific rules:
.table {
border: 1px solid black;
border-spacing: 0px 0px;
border-collapse: collapse;
}
.table th,
.table td {
padding: 5px;
border: 1px solid black;
margin: 0;
}
Note that this is a bit different than 'normal' (not phantomjs-pdf) css where your border-collapse can be located on the <td> element.

Jssor Slider(Banner Slider): How to show a text in two lines

I'm needing to show the Text Slide Banner Jsson on Two lines. When I insert text larger than the box size it does not show, I would text aparececi the row below, ie show the text on two lines.
https://www.flickr.com/photos/robisonweb/15388049446/
I managed to position the text box, failed to show the text on two lines.
https://www.flickr.com/photos/robisonweb/15410760422/
I appreciate the help.
[ ]'s Robison
Please change line-height from 45px to 22px, and change font-size from 20px to 16px;
That's to say, replace
<thumbnailtemplate style="font-family: verdana; font-weight: normal; POSITION: absolute; WIDTH: 100%; HEIGHT: 100%; TOP: 0; LEFT: 0; color:#fff; line-height: 45px; font-size:20px; padding-left:10px;"></thumbnailtemplate>
with
<thumbnailtemplate style="font-family: verdana; font-weight: normal; POSITION: absolute; WIDTH: 100%; HEIGHT: 100%; TOP: 0; LEFT: 0; color:#fff; line-height: 22px; font-size:16px; padding-left:10px;"></thumbnailtemplate>
and then you can define 2 line text thumbnail as below,
<div u="thumb">Do you notice it is draggable by mouse/finger?<br />Second line</div>

How to get all attributes of dom element using dojo

Is there any way to get all attributes of dom element in DOJO (not specific one like domAttr.get("nodeId", "foo")).
<div style="border-width: 2px; border-color: #000000; border-radius: 0px; -moz-border-radius: 0px; height: 100px; background-color: #FFFFFF; -webkit-border-radius: 0px; position: absolute; z-index: 900; width: 193px; left: 57px; top: 106px;" position="absolute" height="100px" width="193px" background-color="#FFFFFF" border-color="#000000" border-width="2px" z-index="900" -webkit-border-radius="0px" -moz-border-radius="0px" border-radius="0px" left="57px" top="106px"></div>
I want to read all attributes in div tag.
Thanks in advance.
I'm not sure if Dojo has a wrapper for this (I've done a brief search of the 1.8.3 source), but you can use Node.attributes.
Dojo does use Node.attributes in places like here in parser.js. Note the special handling of IE8 and IE6-7, to avoid falling foul of the same traps.