Odoo: How to include a 'page break' / second page in custom report (pdf)? - pdf

I created a new report from scratch using this guide: http://odoo.guide/report-design-workshop/
My Problem:
If I have a lot of products on my report the last part including total amount etc. is not shown. I would like to have a kind of page break or at least a second pdf page.
Note: If I use the basic odoo report I have a second page in the pdf but it is shown as this:
http://fs5.directupload.net/images/150924/bf9lsx6u.jpg
Any other ideas are welcome!
Edit:
In the basic report using the page-break tag works realy fine but it didnt affect my own report design at all.
My Code trying to use the page-break tag:
account.Name_report
<?xml version="1.0"?>
<t t-name="account.Name_report">
<t t-call="report.Name_layout">
<t t-foreach="docs" t-as="o"> <!-- this makes the context model data accessible throughout the variable "o" -->
<div class="page">
<div style="color:white">.</div><!--as reference for fixed positions-->
<img src="/document/static/img/Briefpapier_rechnung.svg" style="position: fixed; left:-20px;top:0px;z-index:-100"/>
<div style="color: white;
font-size: 20px;
z-index: 1;
position: fixed;
left: 390px;
top: 36px;
font-size: 38px;">Rechnung
</div>
<!--Adresse-->
<div style="color: black;
font-size: -1px;
z-index: 1;
position: fixed;
top: 138px;
left: 60px;
font-size: 12px;">
<span style="text-decoration: underline;">Adress Adress Adress</span><br/>
<address t-field="o.partner_id" t-field-options="{"widget": "contact", "fields": ["address", "name"], "no_marker": true}"/><br/>
</div>
<!--Kunden Nr/Datum-->
<div style="color: black;
font-size: -1px;
z-index: 1;
position: fixed;
left: 450px;
top: 255px;
font-size: 12px;">
<span>Referenz Nr.:</span><br/>
<span>Datum:</span>
</div>
<div style="color: black;
font-size: -1px;
z-index: 1;
position: fixed;
top: 255px;
right: 0px;
font-size: 12px;
text-align: right;">
<span t-field="o.reference"/><br/>
<span t-field="o.date_invoice"></span>
</div>
<!--Rechnung Nr.-->
<div style="color: black;
font-size: 20px;
z-index: 1;
position: fixed;
left: 0px;
top: 335px;
font-size: 16px;
font-weight: bold;">
<span t-if="o.type == 'out_invoice' and (o.state == 'open' or o.state == 'paid')">Rechnung</span>
<span t-if="o.type == 'out_invoice' and o.state == 'proforma2'">PRO-FORMA</span>
<span t-if="o.type == 'out_invoice' and o.state == 'draft'">Rechnungsentwurf</span>
<span t-if="o.type == 'out_invoice' and o.state == 'cancel'">abgebrochene Rechnung</span>
<span t-if="o.type == 'out_refund'">Erstattung</span>
<span t-if="o.type == 'in_refund'">Lieferant Rückerstattung</span>
<span t-if="o.type == 'in_invoice'">Lieferant Rechnung</span>
<span t-field="o.number"/>
</div>
**<p style="page-break-before:always;"> </p>**
<!--page-break test-->
<div class="row" style="top:400px; position: fixed;">
<!--TABLE-->
<table class="table table-condensed">
<thead>
<tr>
<th>Beschreibung</th>
<th>Menge</th>
<th class="text-right">Einzelpreis EUR</th>
<th class="text-right" groups="sale.group_discount_per_so_line">Rabatt (%)</th>
<th class="text-right">Steuern</th>
<th class="text-center">Gesamtpreis EUR</th>
</tr>
</thead>
<tbody class="invoice_tbody">
<tr t-foreach="o.invoice_line" t-as="l">
<td><span t-field="l.name"/></td>
<td>
<span t-field="l.quantity"/>
<span t-field="l.uos_id" groups="product.group_uom"/>
</td>
<td class="text-right">
<span t-field="l.price_unit"/>
</td>
<td class="text-right" groups="sale.group_discount_per_so_line"><span t-field="l.discount"/></td>
<td class="text-right">
<span t-esc="', '.join(map(lambda x: x.name, l.invoice_line_tax_id))"/>
</td>
<td class="text-right">
<span t-field="l.price_subtotal" t-field-options="{"widget": "monetary", "display_currency": "o.currency_id"}"/>
</td>
</tr>
</tbody>
</table>
<div class="row">
<div class="col-xs-4 pull-right">
<table class="table table-condensed">
<tr class="border-black">
<td><strong>Gesamt Netto</strong></td>
<td class="text-right">
<span t-field="o.amount_untaxed" t-field-options="{"widget": "monetary", "display_currency": "o.currency_id"}"/>
</td>
</tr>
<tr>
<td>Steuern</td>
<td class="text-right">
<span t-field="o.amount_tax" t-field-options="{"widget": "monetary", "display_currency": "o.currency_id"}"/>
</td>
</tr>
<tr class="border-black">
<td><strong>Gesamtbetrag</strong></td>
<td class="text-right">
<span t-field="o.amount_total" t-field-options="{"widget": "monetary", "display_currency": "o.currency_id"}"/>
</td>
</tr>
</table>
</div>
</div>
<div class="row" t-if="o.tax_line">
<div class="col-xs-6">
<table class="table table-condensed">
<thead>
<tr>
<th>Steuern</th>
<th class="text-right">Steuergrundbetrag</th>
<th class="text-right">Betrag</th>
</tr>
</thead>
<tbody>
<tr t-foreach="o.tax_line" t-as="t">
<td><span t-field="t.name"/></td>
<td class="text-right">
<span t-field="t.base" t-field-options="{"widget": "monetary", "display_currency": "o.currency_id"}"/>
</td>
<td class="text-right">
<span t-field="t.amount" t-field-options="{"widget": "monetary", "display_currency": "o.currency_id"}"/>
</td>
</tr>
</tbody>
</table>
<span>Zahlbar innerhalb 14 Tagen ohne Abzug</span>
</div>
</div>
</div>
</div>
</t>
</t>
</t>

There are a few page break types that can be used for Qweb reports.
You can use one of these tags:
<p style="page-break-before:always;"> </p> (most reports use this type)
<p style="page-break-after:always"></p>
<div style="page-break-after: auto;"><span style="display: none;"> </span></div>
<p style="page-break-inside: avoid"></p>
<div style="page-break-inside: auto"></div>

Related

Code Block with table not showing on Mailchimp

I am building an email template on Mailchimp using code blocks in some parts. I have created a seemingly simple table which does show on the visual composer but does not show when I click on Preview or Test.
This is a standalone block, so I don't think I need to insert table anywhere but within a div element. After previewing the entire template and returning to the visual composer, the table disappears but does re-appear after clicking on the element below.
Is there any reason why this happens?
<div class="mcnTextContent" style="margin-left:64px; margin-right:64px">
<table style="font-size: 18px; font-family: Arial, Helvetica, sans-serif; font-color: #1F1F1F; width: 100%; margin-left: auto; margin-right: auto;" border="0">
<tbody>
<tr>
<td style="line-height: 0px !important; padding-bottom: 48px !important;" colspan="3"> </td>
</tr>
<tr>
<td width="33%"><span style="font-size: 10px !important; vertical-align: middle;">🟢 </span> <span style="font-weight: bold;">Year Launch</span>
<div style="line-height: 8px;"> </div>
<span style="font-size: 16px;">2020<br/>UCITs version - 2015</span></td>
<td colspan="2"><span style="font-size: 10px !important; vertical-align: middle;">🟢 </span> <span style="font-weight: bold;">Assets Under Management</span>
<div style="line-height: 8px;"> </div>
<span style="font-size: 16px;">USD $1B strategy<br/>UCITs version - SD $0.4B</span></td>
</tr>
<tr>
<td style="line-height: 0px !important; padding-bottom: 20px !important;" colspan="3"> </td>
</tr>
<tr>
<td width="33%"><span style="font-size: 10px !important; vertical-align: middle;">🟢 </span> <span style="font-weight: bold;">Performance 2020</span>
<div style="line-height: 8px;"> </div>
<span style="font-size: 16px;">5.49%<sup>2</sup></span></td>
<td width="33%"><span style="font-size: 10px !important; vertical-align: middle;">🟢 </span> <span style="font-weight: bold;">YTD Performance</span>
<div style="line-height: 8px;"> </div>
<span style="font-size: 16px;">0.50%<sup>1</sup></span></td>
<td width="33%"><span style="font-size: 10px !important; vertical-align: middle;">🟢 </span> <span style="font-weight: bold;">Yield-to-Worst</span>
<div style="line-height: 8px;"> </div>
<span style="font-size: 16px;">8.95%<sup>2</sup></span></td>
</tr>
<tr>
<td style="line-height: 0px !important; padding-bottom: 20px !important;" colspan="3"> </td>
</tr>
<tr>
<td width="33%"><span style="font-size: 10px !important; vertical-align: middle;">🟢 </span> <span style="font-weight: bold;">Duration</span>
<div style="line-height: 8px;"> </div>
<span style="font-size: 16px;">4 years<sup>1</sup></span></td>
<td width="33%"><span style="font-size: 10px !important; vertical-align: middle;">🟢 </span> <span style="font-weight: bold;">3-year Volatility</span>
<div style="line-height: 8px;"> </div>
<span style="font-size: 16px;">7.23%<sup>2</sup></span></td>
<td width="33%"><span style="font-size: 10px !important; vertical-align: middle;">🟢 </span> <span style="font-weight: bold;"># of Positions</span>
<div style="line-height: 8px;"> </div>
<span style="font-size: 16px;">144<sup>3</sup></span></td>
</tr>
<tr>
<td style="line-height: 0px !important; padding-bottom: 20px !important;" colspan="3"> </td>
</tr>
<tr>
<td width="33%"><span style="font-size: 10px !important; vertical-align: middle;">🟢 </span> <span style="font-weight: bold;">Gross Yield (USD)</span>
<div style="line-height: 8px;"> </div>
<span style="font-size: 16px;">442%<sup>2</sup></span></td>
<td width="33%"><span style="font-size: 10px !important; vertical-align: middle;">🟢 </span> <span style="font-weight: bold;">MTM Yield (USD)</span>
<div style="line-height: 8px;"> </div>
<span style="font-size: 16px;">45%<sup>2</sup></span></td>
<td> </td>
</tr>
<tr>
<td style="line-height: 0px !important; padding-bottom: 20px !important;" colspan="3"> </td>
</tr>
<tr>
<td style="font-size: 12px !important; line-height: 16px;" colspan="3"><sup>1</sup> Source: Morningstar Direct March, 5th, 2021 (HI USD shareclass).<br/> <sup>2</sup> Source: TwentyFour, Bloomberg; February 28th, 2021.<br/> <sup>3</sup> This is now credit issuers only so it excludes ABS and Government (total credit positions = 271). Source: TwentyFour Bloomberg Feb 28th 2021.</td>
</tr>
<tr>
<td style="line-height: 0px !important; padding-bottom: 20px !important;" colspan="3"> </td>
</tr>
<tr>
<td colspan="2"><span style="font-weight: bold; font-size: 24px;">Ratings & Awards</span></td>
<td width="33%"> </td>
</tr>
<tr>
<td style="line-height: 0px !important; padding-bottom: 20px !important;" colspan="3"> </td>
</tr>
<tr>
<td style="padding-right: 40px;" colspan="2"><span style="font-size:20px;">★★★★★</span><div style="line-height: 4px;"> </div>
<span style="font-weight: bold;">Morningstar</span>
<div style="line-height: 8px;"> </div>
<span style="font-size: 16px;">This fund has been awarded.</span></td>
<td style="background-image: url('https://i.ibb.co/Jkd3npD/Untitled-1-copy.jpg'); background-repeat: no-repeat; background-size: 189px 117px; width: 189px; height: 117px;" colspan="1"> </td>
</tr>
<tr>
<td style="line-height: 0px !important; padding-bottom: 48px !important;" colspan="3"> </td>
</tr>
</tbody>
</table>
</div>
In this case, the issue was with the emoji 🟢 I used. For some reason Mailchimp didn't allow the table to render correctly.

Selenium WebDriver XPath points to second row, but findElements returns first row

I have HTML that looks like this:
<table id="data-table" class="table table-striped table-bordered table-hover dataTable no-footer" role="grid" style="width: 100%;">
<thead>
<tr role="row" style="height: 0px;"><th scope="col" class="sorting" aria-controls="data-table" rowspan="1" colspan="1" style="width: 277px; padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px;"><div class="dataTables_sizing" style="height:0;overflow:hidden;">Store Number</div></th><th scope="col" class="sorting" aria-controls="data-table" rowspan="1" colspan="1" style="width: 241px; padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px;"><div class="dataTables_sizing" style="height:0;overflow:hidden;">Store Name</div></th><th scope="col" class="sorting" aria-controls="data-table" rowspan="1" colspan="1" style="width: 156px; padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px;"><div class="dataTables_sizing" style="height:0;overflow:hidden;">Active</div></th><th scope="col" class="sorting" aria-controls="data-table" rowspan="1" colspan="1" style="width: 237px; padding-top: 0px; padding-bottom: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px;"><div class="dataTables_sizing" style="height:0;overflow:hidden;">Action</div></th></tr>
</thead>
<tbody>
<tr id="store-3" data-model="{"Id":3,"Name":"a","IsActive":true,"DBVersion":"","Address":{"Address":"","Address2":"","State":"","City":"","Zip":0},"Phone":""}" role="row" class="odd">
<th scope="row" class="sorting_1">3</th>
<td>a</td>
<td>
<label class="tgl">
<input onclick="ToggleStoreActive(this,event)" class="form-isactive" type="checkbox" checked="">
<span class="tgl_body">
<span class="tgl_switch"></span>
<span class="tgl_track">
<span class="tgl_bgd"></span>
<span class="tgl_bgd tgl_bgd-negative"></span>
</span>
</span>
</label>
</td>
<td>
<button class="btn btn-danger" onclick="DeleteStore(this)">
<i class="fa fa-trash-o" aria-hidden="true"></i>
</button>
<button class="btn btn-primary" onclick="PopModel(this)">
<i class="fa fa-pencil" aria-hidden="true"></i>
</button>
</td>
</tr><tr id="store-4" data-model="{"Id":4,"Name":"b","IsActive":true,"DBVersion":"","Address":{"Address":"","Address2":"","State":"","City":"","Zip":0},"Phone":""}" role="row" class="even">
<th scope="row" class="sorting_1">4</th>
<td>b</td>
<td>
<label class="tgl">
<input onclick="ToggleStoreActive(this,event)" class="form-isactive" type="checkbox" checked="">
<span class="tgl_body">
<span class="tgl_switch"></span>
<span class="tgl_track">
<span class="tgl_bgd"></span>
<span class="tgl_bgd tgl_bgd-negative"></span>
</span>
</span>
</label>
</td>
<td>
<button class="btn btn-danger" onclick="DeleteStore(this)">
<i class="fa fa-trash-o" aria-hidden="true"></i>
</button>
<button class="btn btn-primary" onclick="PopModel(this)">
<i class="fa fa-pencil" aria-hidden="true"></i>
</button>
</td>
</tr><tr id="store-5" data-model="{"Id":5,"Name":"c","IsActive":true,"DBVersion":"","Address":{"Address":"","Address2":"","State":"","City":"","Zip":0},"Phone":""}" role="row" class="odd">
<th scope="row" class="sorting_1">5</th>
<td>c</td>
<td>
<label class="tgl">
<input onclick="ToggleStoreActive(this,event)" class="form-isactive" type="checkbox" checked="">
<span class="tgl_body">
<span class="tgl_switch"></span>
<span class="tgl_track">
<span class="tgl_bgd"></span>
<span class="tgl_bgd tgl_bgd-negative"></span>
</span>
</span>
</label>
</td>
<td>
<button class="btn btn-danger" onclick="DeleteStore(this)">
<i class="fa fa-trash-o" aria-hidden="true"></i>
</button>
<button class="btn btn-primary" onclick="PopModel(this)">
<i class="fa fa-pencil" aria-hidden="true"></i>
</button>
</td>
</tr></tbody>
</table>
and am attempting to get the second row (the one with "Store Number" 4 and "Store Name" 'b'), with the following Groovy code:
'get the initial number of data rows'
String dataRowsSelector = '//table[contains(#id, "data-table")]/tbody/tr'
List<WebElement> dataRows = driver.findElements(By.xpath(dataRowsSelector))
int initialRowCount = dataRows.size()
assertNotEquals(index, 0)
'find the row pointed to by the index'
String rowSelector = String.format('//table[contains(#id, "data-table")]/tbody/tr[%d]', (index + 1))
assertEquals(rowSelector, '//table[contains(#id, "data-table")]/tbody/tr[2]')
WebElement rowToDelete = driver.findElement(By.xpath(rowSelector))
'get the delete button'
String deleteButtonSelector = '//button[./i[contains(concat(" ", #class, " "), " fa-trash-o ")]]'
WebElement deleteButton = rowToDelete.findElement(By.xpath(deleteButtonSelector))
println(rowToDelete.findElement(By.xpath('//td[1]')).getAttribute('innerText'))
assertTrue(rowToDelete.findElement(By.xpath('//td[1]')).getAttribute('innerText').contains('b'))
I run that code, and rowToDelete becomes the first data row instead of the second (I try again with 3 for the index, and it is still the first row), even though the assertion against the target xpath worked. Also, the first <td> for that WebElement contains a and not b. (When I tried with 3 as the index, I get a again, even though I was expecting c.
How do I fix this weird behavior?
The problem was with my XPath itself, apparently. When attempting to select WebElements relative to other WebElements, using XPath, I should put a dot in front of the // to give it the scope.

Unable to select Un Ordered List of 2 similar drop down values through selenium webdriver

I’m trying to automate and select the drop down values.
2 fields are having same drop down values (i.e.). Yes and No and both field has similar HTML code . So unable to find unique Xpath in order to click on second field and it is throwing an org.openqa.selenium.ElementNotInteractableException exception. Since the tag name is not SELECT, so I couldn’t use SELECT Class.
HTML Code:
1st Field
<table id="ssl" class="x-field dropdown x-form-item x-box-item x-field-default x-vbox-form-item x-form-dirty" style="margin: 0px; width: 660px; table-layout: fixed; left: 9px; top: 36px;" cellpadding="0">
<tbody>
<tr id="ssl-inputRow">
<td id="ssl-labelCell" class="x-field-label-cell" style="" halign="left" width="385" valign="top">
<label id="ssl-labelEl" class="x-form-item-label x-form-item-label-left" for="ssl-inputEl" style="width:380px;margin-right:5px;">Use SSL to connect to NetScaler </label>
</td>
<td id="ssl-bodyEl" class="x-form-item-body x-form-trigger-wrap-focus" colspan="2" role="presentation" style="width: 100%;">
<table id="ssl-triggerWrap" class="x-form-trigger-wrap" style="width: 100%; table-layout: fixed;" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td id="ssl-inputCell" class="x-form-trigger-input-cell" style="width: 100%;">
<div id="ext-gen1668" class="x-hide-display x-form-data-hidden" role="presentation"></div>
<input id="ssl-inputEl" class="x-form-field x-form-text x-form-focus x-field-form-focus x-field-default-form-focus" autocomplete="off" name="ssl" readonly="readonly" style="width: 100%; -moz-user-select: text;" aria-invalid="false" data-errorqtip="" type="text">
</td>
<td id="ext-gen1667" class="x-trigger-cell" style="width:22px" valign="top">
<div id="ext-gen1666" class="x-trigger-index-0 x-form-trigger x-form-arrow-trigger x-form-trigger-last x-unselectable" role="button" style="-moz-user-select: none;"></div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
2nd Field:
<table id="isDiscovery" class="x-field dropdown x-form-item x-box-item x-field-default x-vbox-form-item x-form-dirty" style="margin: 0px; width: 660px; table-layout: fixed; left: 9px; top: 67px;" cellpadding="0">
<tbody>
<tr id="isDiscovery-inputRow">
<td id="isDiscovery-labelCell" class="x-field-label-cell" style="" halign="left" width="385" valign="top">
<label id="isDiscovery-labelEl" class="x-form-item-label x-form-item-label-left" for="isDiscovery-inputEl" style="width:380px;margin-right:5px;">Discover StoreFront hosts using this NetScaler </label>
</td>
<td id="isDiscovery-bodyEl" class="x-form-item-body" colspan="2" role="presentation" style="width: 100%;">
<table id="isDiscovery-triggerWrap" class="x-form-trigger-wrap" style="width: 100%; table-layout: fixed;" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td id="isDiscovery-inputCell" class="x-form-trigger-input-cell" style="width: 100%;">
<div id="ext-gen1671" class="x-hide-display x-form-data-hidden" role="presentation"></div>
<input id="isDiscovery-inputEl" class="x-form-field x-form-text" autocomplete="off" name="isDiscovery" readonly="readonly" style="width: 100%; -moz-user-select: text;" aria-invalid="false" data-errorqtip="" type="text">
</td>
<td id="ext-gen1670" class="x-trigger-cell" style="width:22px" valign="top">
<div id="ext-gen1669" class="x-trigger-index-0 x-form-trigger x-form-arrow-trigger x-form-trigger-last x-unselectable" role="button" style="-moz-user-select: none;"></div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
Tried Xpath (but it is failing to select 2nd field)
1st field xpath:
.//*[#id='ssl-inputEl']//following::div[contains(#id,'boundlist-')]/div/ul/li[2][contains(text(), 'No')]
.//*[#id='ssl-inputEl’]//following::div[contains(#id,'boundlist-')]/div/ul/li[1][contains(text(), ‘Yes’)]
.//*[contains(#id,'boundlist-')]/div/ul/li[1][contains(text(), 'Yes')]
.//*[contains(#id,'boundlist-')]/div/ul/li[2][contains(text(), 'No')]
2nd field xpath:
.//*[#id='isDiscovery-inputEl']//following::div[contains(#id,'boundlist-')]/div/ul/li[2][contains(text(), 'No')]
.//*[#id='isDiscovery-inputEl']//following::div[contains(#id,'boundlist-')]/div/ul/li[1][contains(text(), ‘Yes’)]
.//*[contains(#id,'boundlist-')]/div/ul/li[1][contains(text(), 'Yes')]
.//*[contains(#id,'boundlist-')]/div/ul/li[2][contains(text(), 'No')]

How to build a responsive email template using a table structure

I've been reading and researching how to build a responsive email - the thing is I am building it using a table. I know tables are not responsive by nature; however, I've been reading up on responsive design, media queries, and such and I still cannot find a solution. Below is what I have so far. Any help would be greatly appreciated as I would like to learn how to make an email responsive.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Trident Email</title>
<style type="text/css">
#media (max-width: 480px){
table,tbody,tr,td,img {
display:block;
}
div#background {
width: 400px;
}
table#container{
width:300px;
}
}
</style>
</head>
<body>
<div id="background" style="background-color:#eeee00;padding:10px 0;margin:0 320px;">
<table style="margin:0px auto;border-spacing:0px;border-collapse:collapse;text-align:center;" cellpadding="0" cellspacing="0" width="600" align="center">
<tbody>
<tr>
<td>
<table id="container" style="border-spacing:0px;border-collapse:collapse;" cellpadding="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td>
<img src="http://enews.trident.edu/hs-fs/hub/336281/file-2384384346-jpg/Headers_Footers/Trident_is_Coming_to_Town.jpg?t=1446144504152" width="100%" style="vertical-align:bottom;">
</td>
</tr>
<tr>
<td>
<table style="border-spacing;0px;border-collapse:collapse;background-color:rgb(0,39,77);" cellpadding="5" cellspacing="0" width="100%">
<tbody>
<tr>
<td></td>
<tr>
<td style="text-align:left;" width="65%">
<table cellpadding="5" cellspacing="10" width="100%">
<tbody>
<tr>
<td>
<div style="">
<p><span style="color: #9c800d; font-family: helvetica;text-transform:uppercase;"><strong>Date:</strong></span></p>
</div>
</td>
<td width="100%" style="text-align:left;">
<div style="">
<p>
<span style="color: #9c800d; font-family: helvetica;"><strong>November 2, 2015</strong></span>
</p>
</div>
</td>
</tr>
<tr>
<td>
<div style="">
<p>
<span style="color: #9c800d; font-family: helvetica;text-transform:uppercase;"><strong>time:</strong></span>
</p>
</div>
</td>
<td width="100%" style="text-align:left;">
<div style="">
<p>
<span style="color: #9c800d; font-family: helvetica;"><strong>10:00AM - 2:00PM</strong></span>
</p>
</div>
</td>
</tr>
<tr>
<td>
<div style="">
<p>
<span style="color: #9c800d; font-family: helvetica;text-transform:uppercase;"><strong>location:</strong></span>
</p>
</div>
</td>
<td width="100%" style="text-align:left;">
<div style="">
<p>
<span style="color: #9c800d; font-family: helvetica;line-height:1.5;"><strong>Fort Rucker Army Installation<br/>Bldg.4502, Room 303</strong></span>
</p>
</div>
</td>
</tr>
</tbody>
</table>
</td>
<td width="35%" style="text-align:right;">
<div>
<img src="http://enews.trident.edu/hs-fs/hub/336281/file-2668017528-jpg/images/Outreach/James_Shiver_175px.jpg?t=1446144504152" width="100%">
</div>
<p style="text-align:left;" color="#ffffff" align="left"><span style="font-family: helvetica; color: #ffffff;" color="#ffffff"><strong>James Shiver</strong></span><br/><span style="font-family: helvetica; font-size: 13px; color: #ffffff;">334-470-9146</span><br><span style="color: #ffffff;">james.shiver#trident.edu</span></p>
</td>
</tr>
</tbody>
</table>
<table style="border-spacing;0px;border-collapse:collapse;background-color:rgb(0,39,77);" cellpadding="5" cellspacing="0" width="100%">
<tbody>
<tr>
<td width="20"></td>
<td width="80">
<div style="border-top:2px solid #9c800d;width:98%">
<p style="color:#ffffff;text-align:center;font-family:helvetica;font-weight:bold;">
Can't stop by? Visit us Online:
</p>
</div>
</td>
<td width="20"></td>
</tr>
</tbody>
</table>
<table style="border-spacing;0px;border-collapse:collapse;background-color:rgb(0,39,77);text-align:center;" cellpadding="0" cellspacing="0" width="100%" align="center">
<tr>
<td width="20"></td>
<td>
<div>
<p style="text-align:center;color:#ffffff;font-family:helvetica;font-size:14px;">
trident.edu/james
</p>
</div>
</td>
<td width="">
<div>
<p style="text-align:center;color:#ffffff;font-family:helvetica;font-size:14px;">
News and Events
</p>
</div>
</td>
<td>
<div>
<p style="text-align:center;color:#ffffff;font-family:helvetica;font-size:14px;">
University Blog
</p>
</div>
</td>
<td width="20"></td>
</tr>
</table>
<table style="border-spacing;0px;border-collapse:collapse;background-color:rgb(0,39,77);" cellpadding="5" cellspacing="0" width="100%">
<tbody>
<tr>
<td width="20"></td>
<td width="60">
<div>
<p style="color:#ffffff;text-align:center;font-family:helvetica;font-weight:bold;">
Trident University<br/>1212 Plaza Dr.<br/>Cypress, CA 90630
</p>
</div>
</td>
<td width="20"></td>
</tr>
<tr>
<td width="20"></td>
<td width="60">
<div>
<img src="http://enews.trident.edu/hs-fs/hub/336281/file-2102317013-png/outreach_emblem-188px.png?t=1446144504152&width=80&name=outreach_emblem-188px.png" width="80" align="center">
</div>
</td>
<td width="20"></td>
</tr>
<tr>
<td width="20"></td>
<td width="60"><p style="color:#ffffff;font-size:13px">Unsubscribe</p></td>
<td width="20"></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
You need to include an !important in the media query in the <style> so that it can override the inline styles in the email body. This allows table cells to became full width and stack on small viewports.
Here is a basic example of responsive 2-column email layout using media queries:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- META Stuff -->
<!-- CSS Reset -->
<style>
/* Media Queries */
#media screen and (max-width: 600px) {
.email-container {
width: 100% !important;
margin: auto !important;
}
/* What it does: Forces table cells into full-width rows. */
.stack-column {
display: block !important;
width: 100% !important;
max-width: 100% !important;
direction: ltr !important;
}
}
</style>
</head>
<body width="100%" bgcolor="#000000" style="margin: 0; mso-line-height-rule: exactly;">
<center style="width: 100%; background: #000000;">
<!-- Email Body : BEGIN -->
<table role="presentation" cellspacing="0" cellpadding="0" border="0" align="center" width="600" style="margin: auto;" class="email-container">
<!-- 2 Even Columns : BEGIN -->
<tr>
<td bgcolor="#ffffff" align="center" valign="top" style="padding: 10px;">
<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<!-- Column : BEGIN -->
<td class="stack-column">
<table role="presentation" cellspacing="0" cellpadding="0" border="0">
<tr>
<td style="font-family: sans-serif; font-size: 15px; line-height: 20px; color: #555555; padding: 0 10px 10px; text-align: left;">
Column 1 Maecenas sed ante pellentesque, posuere leo id, eleifend dolor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.
</td>
</tr>
</table>
</td>
<!-- Column : END -->
<!-- Column : BEGIN -->
<td class="stack-column">
<table role="presentation" cellspacing="0" cellpadding="0" border="0">
<tr>
<td style="font-family: sans-serif; font-size: 15px; line-height: 20px; color: #555555; padding: 0 10px 10px; text-align: left;">
Column 2 Maecenas sed ante pellentesque, posuere leo id, eleifend dolor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.
</td>
</tr>
</table>
</td>
<!-- Column : END -->
</tr>
</table>
</td>
</tr>
<!-- 2 Even Columns : END -->
</table>
</center>
</body>
Full code available here

Selenium Webdriver: Read a table completely

Scenerio:In a webpage there are few tables present. I want to read one of the table completely, but the problem is only 10 rows are displayed, for rest i have to scroll down. Actually originally only 10 row are available, when we scroll rest of the filed are rendered.
To solve this i thought i will simulate key down and keep reading, but the problem is even the xpath is not consistent through out so cannot put in a loop too. Xpath for few different cells are:
html/body/div[2]/form/div[1]/div[2]/div/div[2]/div/div[2]/div/div[2]/div/div[2]/div/span/div[1]/div/div/div/div[2]/div/div[2]/table/tbody/tr[1]/td[1]
html/body/div[2]/form/div[1]/div[2]/div/div[2]/div/div[2]/div/div[2]/div/div[2]/div/span/div[1]/div/div/div/div[2]/div/div[2]/table[2]/tbody/tr[3]/td[1]
html/body/div[1]/form/div[1]/div[2]/div/div[2]/div/div[2]/div/div[2]/div/div[2]/div/span/div[1]/div/div/div/div[2]/div/div[2]/table[1]/tbody/tr[10]/td[1]
In what way can i get data in all the cells ?
HTML Source:
<div id="pt1:ph1" class="x6v">
<table class="xtb" width="0" cellspacing="0" cellpadding="0" border="0" summary="">
<div class="xvp">
<div>
<div id="pt1:pc1" class="xpb xph" _afrclmwmn="['c1','c2','c3','c4','c5','c6','c7','c8','c9','c10']" _afrac="pt1:pc1:md1" style="height: 282px;">
<div id="pt1:pc1::_ahTp" style="height:auto">
<div id="pt1:pc1::_ahCt">
<div id="pt1:pc1:md1" class="xpj xpb" _leafcolclientids="['pt1:pc1:md1:c1','pt1:pc1:md1:c2','pt1:pc1:md1:c3','pt1:pc1:md1:c4','pt1:pc1:md1:c5','pt1:pc1:md1:c6','pt1:pc1:md1:c7','pt1:pc1:md1:c8','pt1:pc1:md1:c9','pt1:pc1:md1:c10','pt1:pc1:md1:c11','pt1:pc1:md1:c12']" _afrfilterable="true" _afrautohr="10" _afrhcc="0" _afrpcid="pt1:pc1" tabindex="0" style="height: 234px;">
<div id="pt1:pc1:md1::ch" class="xz5" _afrcolcount="12" style="overflow: hidden; position: relative; width: 753px;">
<div id="pt1:pc1:md1::db" class="xyy" _afrcolcount="12" style="position: relative; width: 753px; overflow: hidden; height: 170px; z-index: 1;">
<table class="xyz xzr" cellspacing="0" _startrow="0" _rowcount="44" _selstate="{'0':true}" _totalwidth="1260" style="table-layout:fixed;position:relative;width:1260px;">
<tbody>
<tr class="xzn p_AFSelected" _afrrk="0">
<td class="xzk" nowrap="" style="width:100px;">12</td>
<td class="xzk" nowrap="" style="width:100px;">A12</td>
<td class="xzk" nowrap="" style="width:100px;">B12</td>
<td class="xzk" nowrap="" style="width:100px;">B12</td>
<td class="xzk" nowrap="" style="width:100px;">C12</td>
<td class="xzk" nowrap="" style="width:100px;">D12</td>
<td class="xzk" nowrap="" style="width:100px;"> </td>
<td class="xzk" nowrap="" style="width:100px;">K12</td>
<td class="xzk" nowrap="" style="width:100px;"> </td>
<td class="xzk" nowrap="" style="width:100px;"> </td>
<td class="xzk" nowrap="" style="width:100px;"> </td>
<td class="xzk" nowrap="" style="width:100px;">G12</td>
</tr>
<tr class="xzn" _afrrk="1">
<tr class="xzn" _afrrk="2">
<tr class="xzn" _afrrk="3">
<tr class="xzn" _afrrk="4">
<tr class="xzn" _afrrk="5">
<tr class="xzn" _afrrk="6">
<tr class="xzn" _afrrk="7">
<tr class="xzn" _afrrk="8">
<tr class="xzn" _afrrk="9">
</tbody>
</table>
</div>
<div id="pt1:pc1:md1::sm" class="xzu" style="position:absolute;display:none"></div>
<div id="pt1:pc1:md1::ri" class="xz0" style="position:absolute;display:none;overflow:hidden"></div>
<div id="pt1:pc1:md1::dataW" style="display:none"></div>
<div id="pt1:pc1:md1::scroller" tabindex="-1" style="position: absolute; overflow: auto; z-index: 0; width: 770px; top: 46px; height: 187px; right: 0px;">
</div>
</div>
<div id="pt1:pc1::_ahBt" style="height:auto">
<div id="pt1:pc1:_clmCxt" style="display:none">
<div id="pt1:pc1:_PCPop" style="display:none">
<div id="pt1:pc1::_dchDlgC" style="display:none">
</div>
</div>
</div>
</div>
HTML after scrolling.
<div id="pt1:ph1" class="x6v">
<table class="xtb" width="0" cellspacing="0" cellpadding="0" border="0" summary="">
<div class="xvp">
<div>
<div id="pt1:pc1" class="xpb xph" _afrclmwmn="['c1','c2','c3','c4','c5','c6','c7','c8','c9','c10']" _afrac="pt1:pc1:md1" style="height: 282px;">
<div id="pt1:pc1::_ahTp" style="height:auto">
<div id="pt1:pc1::_ahCt">
<div id="pt1:pc1:md1" class="xpj xpb" _leafcolclientids="['pt1:pc1:md1:c1','pt1:pc1:md1:c2','pt1:pc1:md1:c3','pt1:pc1:md1:c4','pt1:pc1:md1:c5','pt1:pc1:md1:c6','pt1:pc1:md1:c7','pt1:pc1:md1:c8','pt1:pc1:md1:c9','pt1:pc1:md1:c10','pt1:pc1:md1:c11','pt1:pc1:md1:c12']" _afrfilterable="true" _afrautohr="10" _afrhcc="0" _afrpcid="pt1:pc1" tabindex="0" style="height: 234px;">
<div id="pt1:pc1:md1::ch" class="xz5" _afrcolcount="12" style="overflow: hidden; position: relative; width: 753px;">
<div id="pt1:pc1:md1::db" class="xyy" _afrcolcount="12" style="position: relative; width: 753px; overflow: hidden; height: 170px; z-index: 1;">
<table class="xyz xzr" cellspacing="0" _startrow="10" _rowcount="44" style="table-layout:fixed;position:relative;width:1260px;">
<tbody>
<tr class="p_AFFocused p_AFSelected xzn" _afrrk="10">
<tr class="xzn" _afrrk="11">
<tr class="xzn" _afrrk="12">
<tr class="xzn" _afrrk="13">
<tr class="xzn" _afrrk="14">
<tr class="xzn" _afrrk="15">
<tr class="xzn" _afrrk="16">
<tr class="xzn" _afrrk="17">
<tr class="xzn" _afrrk="18">
<tr class="xzn" _afrrk="19">
</tbody>
</table>
<table class="xyz xzr" cellspacing="0" _startrow="20" _rowcount="44" style="table-layout:fixed;position:relative;width:1260px;">
</div>
<div id="pt1:pc1:md1::sm" class="xzu" style="position: absolute; display: none; z-index: 5000; visibility: visible; top: 120px; right: 25px;">Fetching Data...</div>
<div id="pt1:pc1:md1::ri" class="xz0" style="position:absolute;display:none;overflow:hidden"></div>
<div id="pt1:pc1:md1::dataW" style="display:none"></div>
<div id="pt1:pc1:md1::scroller" tabindex="-1" style="position: absolute; overflow: auto; z-index: 0; width: 770px; top: 46px; height: 187px; right: 0px;">
</div>
</div>
<div id="pt1:pc1::_ahBt" style="height:auto">
<div id="pt1:pc1:_clmCxt" style="display:none">
<div id="pt1:pc1:_PCPop" style="display:none">
<div id="pt1:pc1::_dchDlgC" style="display:none">
</div>
</div>
</div>
</div>
<div id="pt1:ph2" class="x6v">
</span>
</div>
</div>
try to use this approach:
1) actions builder, advanced user API
MoveMouseAction method in particular - Moving the mouse from its current location to another element.
you can get here more info about actions builder
2) also dont forget to use fluent wait until web element is rendered
public WebElement fluentWait(final By locator){
Wait<WebDriver> wait = new FluentWait<WebDriver>(driver)
.withTimeout(30, TimeUnit.SECONDS)
.pollingEvery(5, TimeUnit.SECONDS)
.ignoring(NoSuchElementException.class);
WebElement foo = wait.until(
new Function<WebDriver, WebElement>() {
public WebElement apply(WebDriver driver) {
return driver.findElement(locator);
}
}
);
return foo; } ;
By xpathElem=By.xpath("html/body/div[2]/form/div[1]/div[2]/div/div[2]/div/div[2]/div/div[2]/div/div[2]/div/span/div[1]/div/div/div/div[2]/div/div[2]/table/tbody/tr[1]/td[1]");
//getting data from cells
fluentWait(xpathElem).getText().trim();
hope this somehow helps you ;-)