I need xpath to extract this kind of code from website - email

I'm using import.io to extract informations from a website but I'm stucked on the email field only. I managed to extract other information, but this is a little bit confusing for me.
This is the code on the website that I need to extract. And the website has several values with this kind of code, several email addresses.
<td valign="top"><table width="100%" cellspacing="0" cellpadding="3" border="0" class="text_black-11">
<tbody>
<tr>
<td width="35" align="center" class="text_02-11"><img width="16" height="16" src="/interface/icon_www.png"></td>
<td class="text_02-11"><a target="" href="http://www.website.com" class="text_02-11">Visit Website</a></td>
</tr>
<tr>
<td width="35" align="center" class="text_02-11"><img width="19" height="12" src="/interface/icon_email.png"></td>
<td class="text_02-11"><a target="" href="mailto:info#mail.com" class="text_02-11">Send Email</a></td>
</tr>
</tbody>

if you can't target the email directly and it always comes as an hrefinside an a tag with mailto
you can try this
//a[contains (#href, 'mailto:')]/#href
or
//a[contains (., 'Send Email')]/#href
if the website is constructed this way
also if you want to clean that field after selection you can add this regex to the regex field inside import.io
(?<=mailto:).*
just make sure that the xpath works first

Related

Outlook and gmail emails are completely different

I did a template for our email marketing campaing. But on gmail, msn (browser based) are good but on outlook is bad. How can i solve the problem ?
A piece of my code:
<td valign="top" width="194" class="rightColumnContent">
<!-- // Begin Module: Top Image with Content \\ -->
<table border="0" cellpadding="10" cellspacing="0" width="194px" height="194px" style="background-color:#fafafa; margin-top:20px;">
<tr mc:repeatable>
<td valign="top">
<img src="http://cdn.popsbuy.com/emailing/y/images/arama.png" style="max-width:69px;float:left;margin-right:15px;" mc:label="image" mc:edit="tiwc200_image01" /><h4 class="h4" style="float: left;">ARAMA</h4>
<div mc:edit="tiwc200_content01" style="text-align:center; margin-top:10px;clear:both;"><br />
Aradığın ürüne, siteye, markaya doğrudan Popsbuy hesabınla erişebilirsin.
</div>
</td>
</tr>
</table>
<!-- // End Module: Top Image with Content \\ -->
</td>
You need to re-declare your font stack in every table cell.
Also, avoid margin, instead use padding in <td> tags.
Float is also not widely supported. If you want to float, you should be using align="left" instead, but for your example, it is better to keep it in tables.
Your code should look something like this:
<table width="200" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="60">
<img src="http://cdn.popsbuy.com/emailing/y/images/arama.png" mc:label="image" mc:edit="tiwc200_image01" />
</td>
<td width="140" style="font-family: Helvetica, Arial, sans-serif; font-size: 14px; color: #000000; font-weight:bold; padding-left:15px; font">
ARAMA
</td>
</tr>
<tr>
<td width="100%" colspan="2" style="font-family: Helvetica, Arial, sans-serif; font-size: 14px; color: #000000;">
<div mc:edit="tiwc200_content01" style="text-align:center; margin-top:10px;clear:both;"><br />
Aradığın ürüne, siteye, markaya doğrudan Popsbuy hesabınla erişebilirsin.
</div>
</td>
</tr>
</table>
I set the table width 200, you could change it to percentage based if you prefer.
Getting HTML emails to look great across all clients is something that pretty much everyone who has tried to do email marketing runs into. There is no simple answer to your question, but I would start by following some of this advice and testing your email templates with a tool like litmus.
Float simply will not work in Outlook 2007+. Versions of Outlook for Windows from 2007+ use Office as the rendering engine, and thus won't render standard HTML properly.
Align will often work, but the safest course of action is to create a two-column table with the image on the left and the text on the right. The image column should have an explicitly set width. (Don't try to make the table more than one row. In email HTML, it's better to nest a series of simple tables than to create one complex one.)
Make sure that you use the appopriate old-style pre-HTML 4 tag attributes in your table tags. In particular, to get your layout, make sure that the table cells have "valign='middle'".
If you're sending through one of the major email service providers, such as Mailchimp or Campaign Monitor (and you should be, to protect the integrity of your list), it will inline all your style code for you -- so you don't actually need to redeclare the styles for every table cell, you can simply use an embedded stylesheet.

Mailchimp repeatable blocks issue

I have next table in my template:
<table ...>
<tr mc:repeatable mc:hideable>
<td mc:edit="mc-news-item-image"><img .../></td>
<td mc:edit="mc-news-item-h3"><h3>Lorem ipsum.</h3></td>
<td mc:edit="mc-news-item-date"><span>22.10.13</span></td>
</tr>
</table>
In edit campaign mode if I try to dublicate a row I get copy of it but can't edit any block in template. Any help would be much appreciated!
It appears that Mailchimp doesn't allow the hideable and repeatable tags to be on the same table/div.
So you are going to have to use one or the other.

storeTextPresent by ID selenium IDE

---Jump down to my edit with a simplistic example---
I have searched Ad Nauseum, and spent hours getting this close, but still not solving my automation problem.
Here's the thing I convert the local paper from the print edition to the online edition through PDF's, the content gets pushed to the website and is not live, until I go in and edit some settings, a lot of these are redundant. so if I can get past this one point I'm golden and can shave literally hours off of the time it takes to do this work.
The paper has twenty or thirty writers, and the one_off_byline can vary a bit here is some examples.
id=id_one_off_byline value="Michael Reid" however it may also look like the these next two or some variation thereoff even.
id=id_one_off_byline value="By Michael Reid"
id=id_one_off_byline value="By Michael Reid - Your Daily Paper"
I have used storeTextPresent to find Michael on the page. however the problem is there is another select value box on the page that contains every writers name in a selection box, which is what I'm actually trying to populate. So here is what I have
<tr>
<td>storeTextPresent</td>
<td>Jeff</td>
<td>IsTextAppears</td>
</tr>
<tr>
<td>gotoIf</td>
<td>${isTextAppears}</td>
<td>Jeff</td>
</tr>
<tr>
<td>storeTextPresent</td>
<td>Graham</td>
<td>IsTextAppears</td>
</tr>
<tr>
<td>gotoIf</td>
<td>${isTextAppears}</td>
<td>Graham</td>
</tr>
<tr>
<td>label</td>
<td>Jeff</td>
</tr>
<tr>
<td>label</td>
<td>Graham</td>
</tr>
Another way to phrase this I hope___
Form Field 1 (ignore syntax, I'm just setting up an example here) the id= is the important part in the two form fields.
<select name="select" id="pick_animal" value="">
< option="the fast cat" id="1">
< option="the fast dog" id="2">
</select>
Form Field 2
<input type="text" id="some_animal" value="the fast cat from dover">
I need to detect that id="some_animal" contains cat
so I can perform an action on the correct option in field 1.
I can do the second part just fine, I just can't detect "cat" in only the input with id "some_animal"
storeTextPresent just looks for cat to exist anywhere on the page. ugh!!
<tr>
<td>storeTextPresent</td>
<td>Jeff</td>
<td>IsTextAppears</td>
</tr>
<tr>
<td>gotoIf</td>
<td>${isTextAppears}==Jeff</td>
<td>Jeff</td>
</tr>
<tr>
<td>goto</td>
<td>END</td>
<td></td>
</tr>
<tr>
<td>label</td>
<td>Jeff</td>
<td></td>
</tr>
<tr>
<td>echo</td>
<td>something</td>
<td></td>
</tr>
<tr>
<td>label</td>
<td>END</td>
<td></td>
</tr>
Try like this.

Rendering of zero width table cells in Outlook

First off:
I hate Outlook :)
Here is why:
I am trying to send an email with the following structure (this is just a simplified example so please don't tell me "Just get rid of the middle tds")
<table width="400">
<tbody>
<tr>
<td width="200"><img src="http://lorempixel.com/200/200/"></td>
<td width="0"></td>
<td width="0"></td>
<td width="200"><img src="http://lorempixel.com/200/200/"></td>
</tr>
</tbody>
</table>
The problem is, that the two tds in the middle lead to a space between the two pictures as you can see in this screenshot http://i48.tinypic.com/6i8rvk.png
I feel like I have already tried everything possible.
cellpadding = 0, cellspacing = 0, border = 0 on table
setting the width of every td with inline css
adding border-collapse: collapse to all tds and the table
adding margin:0, padding:0; border 0; to all tds in inline css
setting the font-size and line-height to 0 in inline css
Nothing worked.
Side notes:
If there is only one empty table cell in the middle, the rendering is fine. So it seems as if each td only accounts for half a pixel
This is already a simplified example and I cannot change the structure of the table meaning that I have to find a workaround for the rendering problems rather than fixing the rather unpretty coding style unfortunately.
Testing
Here is my testing environment - feel free to play around with it: http://putsmail.com/d58ffa01c4b3e29123baab00754716
try putting padding-left and/or padding-right to the tds containing the images, as inline css.
Latest edit: try this --
<tr>
<td style="border-collapse: collapse; margin:0;padding:0; border:0" align="right" width="200"><img src="http://lorempixel.com/200/200/" style="display:block;margin:0;padding:0; border:0" border="0"></td>
<td style="width: 0px;line-height: 0px; font-size: 0px; border-collapse: collapse;padding:0;margin:0;border:0" width="0"></td>
<td style="width: 0px;line-height: 0px; font-size: 0px; border-collapse: collapse;padding:0;margin:0;border:0" width="0"></td>
<td style="border-collapse: collapse; margin:0;padding:0; border:0" align="left" ><img src="http://lorempixel.com/200/200/" style="display:block;margin:0;padding:0; border:0" border="0"></td></tr>
i removed the width from tds containing images, hence it takes the default width of the images.
Outlook doesn't like hiding content ;-) But what should work - add some conditional code:
<table border="0" cellpadding="0" cellspacing="0" style="width:100%;table-layout:fixed">
<tr>
<td style="width:217px" valign="top">
column 1
</td>
<!--[if !mso]><!--><td style="line-height:0;max-height:0;width:0;overflow:hidden;font-size:0;display:none" valign="top">
hidden column 2
</td>
<!--<![endif]--><td valign="top">
column 3
</td>
</tr>
</table>
To hide it from outlook, the comments around the column with [!mso / endif] are enough. However you may want to hide in also in outlook.com, gmail.com and some others - for this the other styles are included. Don't forget to restore the settings in mobile view with media queries.
Good luck
Oleg
Have you tried putting the <td>s on the same line? That is, removing the linebreak between elements?
(inner element linebreaks are ignored)
<td>Foo
</td><td>
Bar</td>
Does "display: none" help?
<table width="400">
<tbody>
<tr>
<td width="200"><img src="http://lorempixel.com/200/200/"></td>
<td width="0" style="display:none"></td>
<td width="0" style="display:none"></td>
<td width="200"><img src="http://lorempixel.com/200/200/"></td>
</tr>
</tbody>
</table>
Btw, I did not suffer your problem on Outlook 2003, so I cannot verify it.
I have continued trying to solve this problem - nothing (I have tried every proposal here and more) worked.
In the end I went the more difficult but also the cleanest way I believe and wrote a script that removes all empty columns and all empty rows with an xsl transformation. Now it works in Outlook 2003 - 2010.

How to automate DatePicker in Selenium IDE?

<tr>
<td>type</td>
<td>id=release_date</td>
<td>2012-09-30</td>
</tr>
This works but I don't want to type the date but pick it using DatePicker and try automating it.
This will vary greatly depending on how your datepicker is coded. For example, I'm working on a Web app that utilizes Dojo and I'm using the following code to select a specific position within the datepicker pop-up instead of a particular date (because the actual date isn't important for my tests):
<tr>
<td>waitForElementPresent</td>
<td>//*[#id="startDate"]</td>
<td></td>
</tr>
<tr>
<td>clickAt</td>
<td>xpath=(//input[#value='▼ '])[3]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//table[#id='startDate_popup']/tbody/tr/td[4]/span</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//table[#id='startDate_popup']/tbody/tr/td[4]/span</td>
<td></td>
</tr>
I use waitForElementPresent frequently to make sure the JavaScript has time to complete running before the next step in the test is executed.
I've also found that clickAt is useful when clicking within Dojo widgets, and I typically prefer to use XPath for specific targets.
I hope this helps!
As newbie in Selenium IDE these days I done some tests who includes the date picker too.
I'll paste my HTML code, but if you have any problems or anything feel free to ask.
<!--Set some random generators for Hour From/To-->
<tr>
<td>storeEval</td>
<td>[Math.floor((Math.random() * 31) + 1)]</td>
<td>random</td>
</tr>
<tr>
<td>click</td>
<td>//select[#id='valid']/option[3]</td>
<td></td>
</tr>
<!--Add values to From date and To date-->
<tr>
<td>click</td>
<td>id=p_date_from</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>link=${random}</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//div[#id='valid_period']/p[2]/span/span/abbr</td>
<td></td>
</tr>
<tr>
<td>storeEval</td>
<td>[Math.floor((Math.random() * 10) + 1)]</td>
<td>random</td>
</tr>
<tr>
<td>click</td>
<td>link=${random}</td>
<td></td>
</tr>