Пример #1
0
        public void scrapCinemaName(string googleURL)
        {
            IWebDriver driver = new PhantomJSDriver();
            var url = googleURL;
            driver.Navigate().GoToUrl(url);

            for (int i = 0; i < 5; i++)
            {
                //add current page cinemas
                var cinemasName = scrapOnePageCinema(driver);

                //add all
                allCinemas.AddRange(cinemasName);

                //Go goto next on current page
                try
                {
                    var nextUrl = driver.FindElements(By.PartialLinkText("Next")).Last().GetAttribute("href");
                    driver.Navigate().GoToUrl(nextUrl);
                }
                catch (InvalidOperationException e)
                {
                    //Console.WriteLine(e.Source);
                }

            }

            //close driver
            driver.Dispose();
        }
Пример #2
0
        static void Main(string[] args)
        {
            // web parser
            //BrowserDemo.OpenHtmlUnitDriver();
            // BrowserDemo.OpenPhantomJs();

            //TrackingDemo.TrackWithoutBrowser();
            //TrackingDemo.TrackWithChrome();

            // start http server
            //using (var server = new HttpServer("http://*****:*****@" <!DOCTYPE html><!--29175c33-bb68-31a4-a326-3fc888d22e35_v33--><html><head><meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot;></meta><style id=&quot;DS3Style&quot; type=&quot;text/css&quot;>@media only screen and (max-width: 620px) {body[yahoo] .device-width {	width: 450px !important}body[yahoo] .threeColumns {	width: 140px !important}body[yahoo] .threeColumnsTd {	padding: 10px 4px !important}body[yahoo] .fourColumns {	width: 225px !important}body[yahoo] .fourColumnsLast {	width: 225px !important}body[yahoo] .fourColumnsTd {	padding: 10px 0px !important}body[yahoo] .fourColumnsPad {	padding: 0 0 0 0 !important}body[yahoo] .secondary-product-image {	width: 200px !important;	height: 200px !important}body[yahoo] .center {	text-align: center !important}body[yahoo] .twoColumnForty {	width: 200px !importantheight: 200px !important}body[yahoo] .twoColumnForty img {	width: 200px !important;	height: 200px !important}body[yahoo] .twoColumnSixty {	width: 228px !important}body[yahoo] .secondary-subhead-right {	display: none !important}body[yahoo] .secondary-subhead-left {	width: 450px !important}}@media only screen and (max-width: 479px) {body[yahoo] .navigation {	display: none !important}body[yahoo] .device-width {	width: 300px !important;	padding: 0}body[yahoo] .threeColumns {	width: 150px !important}body[yahoo] .fourColumns {	width: 150px !important}body[yahoo] .fourColumnsLast {	width: 150px !important}body[yahoo] .fourColumnsTd {	padding: 10px 0px !important}body[yahoo] .fourColumnsPad {	padding: 0 0 0 0 !important}body[yahoo] .secondary-product-image {	width: 240px !important;	height: 240px !important}body[yahoo] .single-product-table {	float: none !important;margin-bottom: 10px !important;margin-right: auto !important;margin-left: auto !important;}body[yahoo] .single-product-pad {	padding: 0 0 0 0 !important;}body[yahoo] .single-product-image {align:center;width: 200px !important;height: 200px !important}body[yahoo] .mobile-full-width {	width: 300px !important}body[yahoo] .twoColumnForty {align:center; !importantwidth: 200px !important}body[yahoo] .twoColumnForty img {}body[yahoo] .twoColumnSixty {padding-left: 0px !important;width: 300px !important}body[yahoo] .secondary-subhead-left {	width: 300px !important}body[yahoo] .ThreeColumnItemTable{        padding: 0px 0px 0px 74px !important}body[yahoo] .FourColumnFloater{float: right !important;}span.message-history{text-align: left !important;float: right !important;}}body[yahoo] .mobile-full-width {	min-width: 103px;max-width: 300px;height: 38px;}body[yahoo] .mobile-full-width a {	display: block;padding: 10px 0;}body[yahoo] .mobile-full-width td{	padding: 0px !important}td.wrapText{white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word; }@-moz-document url-prefix() {td.wrapTextFF_Fix {display: inline-block}}body { width: 100% !important; -webkit-text-size-adjust: 100% !important; -ms-text-size-adjust: 100% !important; -webkit-font-smoothing: antialiased !important; margin: 0 !important; padding: 0 0 100px !important; font-family: Helvetica, Arial, sans-serif !important; background-color:#f9f9f9}.ReadMsgBody { width: 100% !important; background-color: #ffffff !important; }.ExternalClass { width: 100% !important; }.ExternalClass { line-height: 100% !important; }img { display: block; outline: none !important; text-decoration: none !important; -ms-interpolation-mode: bicubic !important; }td{word-wrap: break-word;}</style><!--[if gte mso 9]>	<style>td.product-details-block{word-break:break-all}.threeColumns{width:140px !important}.threeColumnsTd{padding:10px 20px !important}.fourColumns{width:158px !important}.fourColumnsPad{padding: 0 18px 0 0 !important}.fourColumnsTd{padding:10px 0px !important}.twoColumnSixty{width:360px !important}table{mso-table-lspace:0pt; mso-table-rspace:0pt;}</style>	<![endif]--></head><body yahoo=&quot;fix&quot;><table id=&quot;area2Container&quot; width=&quot;100%&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; align=&quot;center&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color:#f9f9f9&quot;><tr><td width=&quot;100%&quot; valign=&quot;top&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none;&quot;><table width=&quot;600&quot; class=&quot;device-width header-logo&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; align=&quot;center&quot; bgcolor=&quot;#f9f9f9&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none;&quot;><tr><td valign=&quot;top&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; padding: 0; border: none;&quot;><p style=&quot;font-family: Helvetica, Arial, sans-serif; font-weight: normal; line-height: normal; color: #888888; text-align: left; font-size: 11px; margin: 5px 0 10px 0; color: #333;&quot; align=&quot;left&quot;>New message: Hi Kobo,As a buyer, I am interest...</p></td></tr></table></td></tr></table> <table id=&quot;area3Container&quot; width=&quot;100%&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; align=&quot;center&quot; style=&quot;border-collapse:collapse !important;border-spacing:0 !important;border:none;background-color:#f9f9f9;&quot;><tr><td width=&quot;100%&quot; valign=&quot;top&quot; style=&quot;border-collapse:collapse !important;border-spacing:0 !important;border:none;&quot;><table width=&quot;100%&quot; height=&quot;7&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; align=&quot;center&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-image: url(&apos;http://p.ebaystatic.com/aw/navbar/preHeaderBottomShadow.png&apos;); background-repeat: repeat-y no-repeat; margin: 0; padding: 0&quot;><!--[if gte mso 9]><v:rect xmlns:v=&quot;urn:schemas-microsoft-com:vml&quot; fill=&quot;true&quot; stroke=&quot;false&quot; style=&quot;mso-width-percent:1000;height:1px;&quot;><v:fill type=&quot;tile&quot; color=&quot;#dddddd&quot; /></v:rect><v:rect xmlns:v=&quot;urn:schemas-microsoft-com:vml&quot; fill=&quot;true&quot; stroke=&quot;false&quot; style=&quot;mso-width-percent:1000;height:6px;&quot;><v:fill type=&quot;tile&quot; src=&quot;http://p.ebaystatic.com/aw/navbar/preHeaderBottomShadow.png&quot; color=&quot;#f9f9f9&quot; /><div style=&quot;width:0px; height:0px; overflow:hidden; display:none; visibility:hidden; mso-hide:all;&quot;><![endif]--><tr><td width=&quot;100%&quot; height=&quot;1&quot; valign=&quot;top&quot; align=&quot;center&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color: #dddddd; font-size: 1px; line-height: 1px;&quot;><!--[if gte mso 15]>&amp;nbsp;<![endif]--></td></tr><tr><td width=&quot;100%&quot; height=&quot;6&quot; valign=&quot;top&quot; align=&quot;center&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color: none; font-size: 1px; line-height: 1px;&quot;>&amp;nbsp;</td></tr><!--[if gte mso 9]></div></v:rect><![endif]--></table></td></tr></table>   <table id=&quot;area4Container&quot; width=&quot;100%&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; align=&quot;center&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color:#f9f9f9&quot;><tr><td width=&quot;100%&quot; valign=&quot;top&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none;&quot;><table width=&quot;600&quot; class=&quot;device-width header-logo&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; align=&quot;center&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none;&quot;><tr><td valign=&quot;top&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; padding: 15px 0 20px; border: none;&quot;><a href=&quot;http://rover.ebay.com/rover/0/e12050.m1831.l3127/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&amp;loc=http%3A%2F%2Fpages.ebay.com%2Flink%2F%3Fnav%3Dhome%26alt%3Dweb%26globalID%3DEBAY-ENCA%26referrer%3Dhttp%253A%252F%252Frover.ebay.com%252Frover%252F0%252Fe12050.m1831.l3127%252F7%253Feuid%253D68fe0bd048d04a84b6d8ef4046dde4cd%2526cp%253D1&quot; style=&quot;text-decoration: none; color: #0654ba;&quot;><img src=&quot;http://p.ebaystatic.com/aw/logos/header_ebay_logo_132x46.gif&quot; width=&quot;132&quot; height=&quot;46&quot; border=&quot;0&quot; alt=&quot;eBay&quot; align=&quot;left&quot; style=&quot;display: inline block; outline: none; text-decoration: none; -ms-interpolation-mode: bicubic; border: none;&quot; /></a><img src=&quot;http://rover.ebay.com/roveropen/0/e12050/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&quot; alt=&quot;&quot; style=&quot;border:0; height:1;&quot;/></td></tr></table></td></tr></table> <table id=&quot;area5Container&quot; width=&quot;100%&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; align=&quot;center&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; background-color:#f9f9f9&quot;>  <tr>    <td width=&quot;100%&quot; valign=&quot;top&quot;   style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none;&quot;>    <table id=&quot;PrimaryMessage&quot; width=&quot;600&quot; class=&quot;device-width&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; align=&quot;center&quot; bgcolor=&quot;#f9f9f9&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none;&quot;>      <tr><td valign=&quot;top&quot; class=&quot;secondary-headline&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; padding: 20px 0 5px;&quot;><h1 style=&quot;font-family: Helvetica, Arial, sans-serif; font-weight: normal; line-height: 15px; color: #808284; text-align: left; font-size: 13px; margin: 0 0 4px;&quot; align=&quot;left&quot;>New message from:<a href=&quot;http://rover.ebay.com/rover/0/e12050.m44.l1181/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&amp;loc=http%3A%2F%2Fpages.ebay.com%2Flink%2F%3Fnav%3Duser.view%26user%3Dandfen6%26globalID%3DEBAY-ENCA%26referrer%3Dhttp%253A%252F%252Frover.ebay.com%252Frover%252F0%252Fe12050.m44.l1181%252F7%253Feuid%253D68fe0bd048d04a84b6d8ef4046dde4cd%2526cp%253D1&quot; style=&quot;text-decoration: none; font-weight: bold; color: #336fb7;&quot;>andfen6</a><a href=&quot;http://rover.ebay.com/rover/0/e12050.m44.l1183/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&amp;loc=http%3A%2F%2Ffeedback.ebay.ca%2Fws%2FeBayISAPI.dll%3FViewFeedback%26userid%3Dandfen6%26ssPageName%3DSTRK%3AME%3AUFS&quot; style=&quot;text-decoration: none; color: #888888;&quot;>(5)</a></h1></td></tr>            <tr><td valign=&quot;top&quot; class=&quot;viewing-problem-block&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border-bottom-width: 1px; border-bottom-color: #f9f9f9; padding: 10px 0 30px; border-style: none none solid;&quot;>          <table width=&quot;600&quot; class=&quot;device-width&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none; border:0; cellpadding:0; cellspacing:0; align:center; bgcolor:#f9f9f9;&quot;>               <tr><td width=&quot;100%&quot; class=&quot;wrapText device-width&quot; valign=&quot;top&quot; style=&quot;overflow: hidden; border-collapse: collapse !important; border-spacing: 0 !important; border: none; display: inline-block; max-width:600px;&quot;><h3 style=&quot;font-family: Helvetica, Arial, sans-serif; font-weight: normal; line-height: 19px; color: #231f20; text-align: left; font-size: 14px; margin: 0 0 2px; font-weight:none;&quot; align=&quot;left&quot;><div id=&quot;UserInputtedText&quot;>Hi Kobo,<br /><br />As a buyer, I am interested....<br /><br />this is a test message</div></h3>                    <span style=&quot;color:#666666&quot;></span>				</td></tr>              <tr><td valign=&quot;top&quot; width=&quot;15&quot; height=&quot;15&quot; style=&quot;border-collapse: collapse !important; border-spacing: 20 !important; border: none;&quot;></td></tr>              <tr><td valign=&quot;top&quot; class=&quot;cta-block&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; padding: 5px 0 5px; border: none;&quot;><table align=&quot;left&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot; class=&quot;mobile-full-width&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none;&quot;><tr><td valign=&quot;top&quot; class=&quot;center cta-button primary-cta-button&quot; align=&quot;center&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; font-size: 14px; line-height: normal; font-weight: bold; box-shadow: 2px 3px 0 #e5e5e5; filter: progid:DXImageTransform.Microsoft.gradient( startColorstr=&apos;#0079bc&apos;, endColorstr=&apos;#00519e&apos;,GradientType=0 ); background-image: linear-gradient(to bottom,  #0079bc 0%,#00519e 100%); background-color: #0079bc; padding: 10px 17px; border: 1px solid #00519e;&quot; bgcolor=&quot;#0079bc&quot;><a href=&quot;http://rover.ebay.com/rover/0/e12050.m44.l1139/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&amp;loc=http%3A%2F%2Fcontact.ebay.ca%2Fws%2FeBayISAPI.dll%3FM2MContact%26requested%3Dandfen6%26qid%3D1291497258010%26redirect%3D0&quot; style=&quot;text-decoration: none; color: #ffffff; font-size: 14px; line-height: normal; font-weight: bold; font-family: Helvetica, Arial, sans-serif; text-shadow: 1px 1px 0 #00519e;&quot;><span style=&quot;padding: 0px 10px&quot;>Reply</span></a></td></tr></table>                </td></tr>           </table></td></tr></table>    <!--[if !mso]><!--><div id=&quot;V4PrimaryMessage&quot;  style=&quot;max-height: 0px; font-size: 0; overflow:hidden; display: none !important;&quot;><div><table border=&quot;0&quot; cellpadding=&quot;2&quot; cellspacing=&quot;3&quot; width=&quot;100%&quot;><tr><td><font style=&quot;font-size:10pt; font-family:arial, sans-serif; color:#000&quot;><strong>Dear rakutenkobo,</strong><br><br>Hi Kobo,<br /><br />As a buyer, I am interested....<br /><br />this is a test message<br><br></font><div style=&quot;font-weight:bold; font-size:10pt; font-family:arial, sans-serif; color:#000&quot;>- andfen6</div></td><td valign=&quot;top&quot; width=&quot;185&quot;><div></div></td></tr></table></div></div><!--<![endif]-->	</td>  </tr></table> <table id=&quot;area3Container&quot; width=&quot;100%&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; align=&quot;center&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color:#f9f9f9&quot;>    <tr>      <td width=&quot;100%&quot; valign=&quot;top&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none;&quot;><table width=&quot;100%&quot; height=&quot;7&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; align=&quot;center&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-image: url(&amp;#39;http://p.ebaystatic.com/aw/navbar/preHeaderBottomShadow.png&amp;#39;); background-repeat: repeat-y no-repeat; margin: 0; padding: 0&quot;>  <tr><td width=&quot;100%&quot; height=&quot;1&quot; valign=&quot;top&quot; align=&quot;center&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color: #dddddd;&quot;></td></tr>  <tr><td width=&quot;100%&quot; height=&quot;6&quot; valign=&quot;top&quot; align=&quot;center&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color: none;&quot;></td></tr></table>      </td>    </tr>  </table> <table id=&quot;area7Container&quot; width=&quot;100%&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; align=&quot;center&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color:#f9f9f9;&quot;>  <tr>    <td width=&quot;100%&quot; valign=&quot;top&quot;   style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none;&quot;>    <table width=&quot;600&quot; class=&quot;device-width&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; align=&quot;center&quot; bgcolor=&quot;#f9f9f9&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none;&quot;>            <tr><td valign=&quot;top&quot; align=&quot;center&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none; padding-right:20px;&quot;><h1 style=&quot;font-family: Helvetica, Arial, sans-serif; font-weight: bold; line-height: 22px; color: #808284; text-align: left; font-size: 16px; text-align: left; margin-top: 0px; border-style: none none solid; border-bottom-color: #dddddd; border-bottom-width: 1px;&quot; align=&quot;left&quot;>Get to know <a href=&quot;http://rover.ebay.com/rover/0/e12050.m3965.l1181/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&amp;loc=http%3A%2F%2Fpages.ebay.com%2Flink%2F%3Fnav%3Duser.view%26user%3Dandfen6%26globalID%3DEBAY-ENCA%26referrer%3Dhttp%253A%252F%252Frover.ebay.com%252Frover%252F0%252Fe12050.m3965.l1181%252F7%253Feuid%253D68fe0bd048d04a84b6d8ef4046dde4cd%2526cp%253D1&quot; style=&quot;text-decoration: none; color: #336fb7;&quot;>andfen6</a> </h1><table style=&quot;font-family: Helvetica, Arial, sans-serif; font-weight: normal; line-height: 19px; text-align: left; font-size: 14px; margin-bottom: 10px; padding-bottom: 10px;&quot; align=&quot;left&quot;><tr><td valign=&quot;top&quot; style=&quot;font-size: 20px; padding-left: 15px; padding-right: 5px;&quot;>&amp;bull;</td><td style=&quot;padding-bottom: 5px&quot;>Located: Toronto, ON, Canada</td></tr><tr><td valign=&quot;top&quot; style=&quot;font-size: 20px; padding-left: 15px; padding-right: 5px;&quot;>&amp;bull;</td><td style=&quot;padding-bottom: 5px&quot;>Member since: Dec 17, 2015</td></tr><tr><td valign=&quot;top&quot; style=&quot;font-size: 20px; padding-left: 15px; padding-right: 5px;&quot;>&amp;bull;</td><td style=&quot;padding-bottom: 5px&quot;>Positive Feedback: 100%</td></tr></table></td></tr></table></td></tr></table>  <table id=&quot;area10Container&quot; class=&quot;whiteSection&quot; width=&quot;100%&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; align=&quot;center&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color: #ffffff&quot;>  <tr>    <td width=&quot;100%&quot; valign=&quot;top&quot;   style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none;&quot;>    		<table width=&quot;600&quot; class=&quot;device-width&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; align=&quot;center&quot; bgcolor=&quot;#ffffff&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none;&quot;><tr><td valign=&quot;top&quot; class=&quot;viewing-problem-block&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border-bottom-width: 1px; border-bottom-color: #dddddd; padding: 40px 0 30px; border-style: none none solid;&quot;><p style=&quot;font-family: Helvetica, Arial, sans-serif; font-weight: normal; line-height: normal; color: #888888; text-align: left; font-size: 11px; margin: 0 0 10px;&quot; align=&quot;center&quot;>Only purchases on eBay are covered by the eBay purchase protection programs. Asking your trading partner to complete a transaction outside of eBay is not allowed.</p></td></tr></table>	</td>  </tr></table> <table id=&quot;area11Container&quot; class=&quot;whiteSection&quot; width=&quot;100%&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; align=&quot;center&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color: #ffffff&quot;><tr><td width=&quot;100%&quot; valign=&quot;top&quot;   style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none;&quot;>              <table width=&quot;600&quot; class=&quot;device-width&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; align=&quot;center&quot;   style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none;&quot;><tr><td valign=&quot;top&quot; class=&quot;ebay-footer-block&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; padding: 40px 0 60px; border: none;&quot;>   		<div id=&quot;ReferenceId&quot;><p style=&quot;font-family: Helvetica, Arial, sans-serif; font-weight: normal; line-height: normal; color: #888888; text-align: left; font-size: 11px; margin: 0 0 10px;&quot; align=&quot;left&quot;><strong>Email reference id: [#a05-c1pifaockd#]_[#68fe0bd048d04a84b6d8ef4046dde4cd#]</strong></p></div><p style=&quot;font-family: Helvetica, Arial, sans-serif; font-weight: normal; line-height: normal; color: #888888; text-align: left; font-size: 11px; margin: 0 0 10px;&quot; align=&quot;left&quot;>We don&apos;t check this mailbox, so please don&apos;t reply to this message. If you have a question, go to <a style=&quot;text-decoration: none; color: #555555;&quot; href=&quot;http://rover.ebay.com/rover/0/e12050.m1852.l6369/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&amp;loc=http%3A%2F%2Focsnext.ebay.ca%2Focs%2Fhome&quot; target=&quot;_blank&quot;>Help &amp; Contact</a>.</p>		    <p style=&quot;font-family: Helvetica, Arial, sans-serif; font-weight: normal; line-height: normal; color: #888888; text-align: left; font-size: 11px; margin: 0 0 10px;&quot; align=&quot;left&quot;>eBay sent this message to Nantha Gopalasamy (rakutenkobo). Learn more about <a style=&quot;text-decoration: none; color: #555555;&quot; href=&quot;http://rover.ebay.com/rover/0/e12050.m1852.l3167/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&amp;loc=http%3A%2F%2Fpages.ebay.ca%2Fhelp%2Faccount%2Fprotecting-account.html&quot; target=&quot;_blank&quot;>account protection</a>. eBay is committed to your privacy. Learn more about our <a style=&quot;text-decoration: none; color: #555555;&quot; href=&quot;http://rover.ebay.com/rover/0/e12050.m1852.l3168/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&amp;loc=http%3A%2F%2Fpages.ebay.ca%2Fhelp%2Fpolicies%2Fprivacy-policy.html&quot; target=&quot;_blank&quot;>privacy policy</a> and <a style=&quot;text-decoration: none; color: #555555;&quot; href=&quot;http://rover.ebay.com/rover/0/e12050.m1852.l3165/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&amp;loc=http%3A%2F%2Fpages.ebay.ca%2Fhelp%2Fpolicies%2Fuser-agreement.html&quot; target=&quot;_blank&quot;>user agreement</a>.</p><p style=&quot;font-family: Helvetica, Arial, sans-serif; font-weight: normal; line-height: normal; color: #888888; text-align: left; font-size: 11px; margin: 0 0 10px;&quot; align=&quot;left&quot;>&amp;copy;2016 eBay Inc., eBay International AG Helvetiastrasse 15/17 - P.O. Box 133, 3000 Bern 6, Switzerland</p></td></tr></table></td></tr></table></body></html>"))
            //{
            //    Thread thread = new Thread(server.Start);
            //    thread.IsBackground = false;
            //    thread.Start();
            //    Console.WriteLine("server started");
            //    using (var driver = new PhantomJSDriver())
            //    {
            //        WebDriverWait driverWait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
            //        driver.Manage().Window.Maximize();
            //        driver.Navigate().GoToUrl("http://*****:*****@" <!DOCTYPE html><!--29175c33-bb68-31a4-a326-3fc888d22e35_v33--><html><head><meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot;></meta><style id=&quot;DS3Style&quot; type=&quot;text/css&quot;>@media only screen and (max-width: 620px) {body[yahoo] .device-width {	width: 450px !important}body[yahoo] .threeColumns {	width: 140px !important}body[yahoo] .threeColumnsTd {	padding: 10px 4px !important}body[yahoo] .fourColumns {	width: 225px !important}body[yahoo] .fourColumnsLast {	width: 225px !important}body[yahoo] .fourColumnsTd {	padding: 10px 0px !important}body[yahoo] .fourColumnsPad {	padding: 0 0 0 0 !important}body[yahoo] .secondary-product-image {	width: 200px !important;	height: 200px !important}body[yahoo] .center {	text-align: center !important}body[yahoo] .twoColumnForty {	width: 200px !importantheight: 200px !important}body[yahoo] .twoColumnForty img {	width: 200px !important;	height: 200px !important}body[yahoo] .twoColumnSixty {	width: 228px !important}body[yahoo] .secondary-subhead-right {	display: none !important}body[yahoo] .secondary-subhead-left {	width: 450px !important}}@media only screen and (max-width: 479px) {body[yahoo] .navigation {	display: none !important}body[yahoo] .device-width {	width: 300px !important;	padding: 0}body[yahoo] .threeColumns {	width: 150px !important}body[yahoo] .fourColumns {	width: 150px !important}body[yahoo] .fourColumnsLast {	width: 150px !important}body[yahoo] .fourColumnsTd {	padding: 10px 0px !important}body[yahoo] .fourColumnsPad {	padding: 0 0 0 0 !important}body[yahoo] .secondary-product-image {	width: 240px !important;	height: 240px !important}body[yahoo] .single-product-table {	float: none !important;margin-bottom: 10px !important;margin-right: auto !important;margin-left: auto !important;}body[yahoo] .single-product-pad {	padding: 0 0 0 0 !important;}body[yahoo] .single-product-image {align:center;width: 200px !important;height: 200px !important}body[yahoo] .mobile-full-width {	width: 300px !important}body[yahoo] .twoColumnForty {align:center; !importantwidth: 200px !important}body[yahoo] .twoColumnForty img {}body[yahoo] .twoColumnSixty {padding-left: 0px !important;width: 300px !important}body[yahoo] .secondary-subhead-left {	width: 300px !important}body[yahoo] .ThreeColumnItemTable{        padding: 0px 0px 0px 74px !important}body[yahoo] .FourColumnFloater{float: right !important;}span.message-history{text-align: left !important;float: right !important;}}body[yahoo] .mobile-full-width {	min-width: 103px;max-width: 300px;height: 38px;}body[yahoo] .mobile-full-width a {	display: block;padding: 10px 0;}body[yahoo] .mobile-full-width td{	padding: 0px !important}td.wrapText{white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word; }@-moz-document url-prefix() {td.wrapTextFF_Fix {display: inline-block}}body { width: 100% !important; -webkit-text-size-adjust: 100% !important; -ms-text-size-adjust: 100% !important; -webkit-font-smoothing: antialiased !important; margin: 0 !important; padding: 0 0 100px !important; font-family: Helvetica, Arial, sans-serif !important; background-color:#f9f9f9}.ReadMsgBody { width: 100% !important; background-color: #ffffff !important; }.ExternalClass { width: 100% !important; }.ExternalClass { line-height: 100% !important; }img { display: block; outline: none !important; text-decoration: none !important; -ms-interpolation-mode: bicubic !important; }td{word-wrap: break-word;}</style><!--[if gte mso 9]>	<style>td.product-details-block{word-break:break-all}.threeColumns{width:140px !important}.threeColumnsTd{padding:10px 20px !important}.fourColumns{width:158px !important}.fourColumnsPad{padding: 0 18px 0 0 !important}.fourColumnsTd{padding:10px 0px !important}.twoColumnSixty{width:360px !important}table{mso-table-lspace:0pt; mso-table-rspace:0pt;}</style>	<![endif]--></head><body yahoo=&quot;fix&quot;><table id=&quot;area2Container&quot; width=&quot;100%&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; align=&quot;center&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color:#f9f9f9&quot;><tr><td width=&quot;100%&quot; valign=&quot;top&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none;&quot;><table width=&quot;600&quot; class=&quot;device-width header-logo&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; align=&quot;center&quot; bgcolor=&quot;#f9f9f9&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none;&quot;><tr><td valign=&quot;top&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; padding: 0; border: none;&quot;><p style=&quot;font-family: Helvetica, Arial, sans-serif; font-weight: normal; line-height: normal; color: #888888; text-align: left; font-size: 11px; margin: 5px 0 10px 0; color: #333;&quot; align=&quot;left&quot;>New message: Hi Kobo,As a buyer, I am interest...</p></td></tr></table></td></tr></table> <table id=&quot;area3Container&quot; width=&quot;100%&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; align=&quot;center&quot; style=&quot;border-collapse:collapse !important;border-spacing:0 !important;border:none;background-color:#f9f9f9;&quot;><tr><td width=&quot;100%&quot; valign=&quot;top&quot; style=&quot;border-collapse:collapse !important;border-spacing:0 !important;border:none;&quot;><table width=&quot;100%&quot; height=&quot;7&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; align=&quot;center&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-image: url(&apos;http://p.ebaystatic.com/aw/navbar/preHeaderBottomShadow.png&apos;); background-repeat: repeat-y no-repeat; margin: 0; padding: 0&quot;><!--[if gte mso 9]><v:rect xmlns:v=&quot;urn:schemas-microsoft-com:vml&quot; fill=&quot;true&quot; stroke=&quot;false&quot; style=&quot;mso-width-percent:1000;height:1px;&quot;><v:fill type=&quot;tile&quot; color=&quot;#dddddd&quot; /></v:rect><v:rect xmlns:v=&quot;urn:schemas-microsoft-com:vml&quot; fill=&quot;true&quot; stroke=&quot;false&quot; style=&quot;mso-width-percent:1000;height:6px;&quot;><v:fill type=&quot;tile&quot; src=&quot;http://p.ebaystatic.com/aw/navbar/preHeaderBottomShadow.png&quot; color=&quot;#f9f9f9&quot; /><div style=&quot;width:0px; height:0px; overflow:hidden; display:none; visibility:hidden; mso-hide:all;&quot;><![endif]--><tr><td width=&quot;100%&quot; height=&quot;1&quot; valign=&quot;top&quot; align=&quot;center&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color: #dddddd; font-size: 1px; line-height: 1px;&quot;><!--[if gte mso 15]>&amp;nbsp;<![endif]--></td></tr><tr><td width=&quot;100%&quot; height=&quot;6&quot; valign=&quot;top&quot; align=&quot;center&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color: none; font-size: 1px; line-height: 1px;&quot;>&amp;nbsp;</td></tr><!--[if gte mso 9]></div></v:rect><![endif]--></table></td></tr></table>   <table id=&quot;area4Container&quot; width=&quot;100%&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; align=&quot;center&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color:#f9f9f9&quot;><tr><td width=&quot;100%&quot; valign=&quot;top&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none;&quot;><table width=&quot;600&quot; class=&quot;device-width header-logo&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; align=&quot;center&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none;&quot;><tr><td valign=&quot;top&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; padding: 15px 0 20px; border: none;&quot;><a href=&quot;http://rover.ebay.com/rover/0/e12050.m1831.l3127/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&amp;loc=http%3A%2F%2Fpages.ebay.com%2Flink%2F%3Fnav%3Dhome%26alt%3Dweb%26globalID%3DEBAY-ENCA%26referrer%3Dhttp%253A%252F%252Frover.ebay.com%252Frover%252F0%252Fe12050.m1831.l3127%252F7%253Feuid%253D68fe0bd048d04a84b6d8ef4046dde4cd%2526cp%253D1&quot; style=&quot;text-decoration: none; color: #0654ba;&quot;><img src=&quot;http://p.ebaystatic.com/aw/logos/header_ebay_logo_132x46.gif&quot; width=&quot;132&quot; height=&quot;46&quot; border=&quot;0&quot; alt=&quot;eBay&quot; align=&quot;left&quot; style=&quot;display: inline block; outline: none; text-decoration: none; -ms-interpolation-mode: bicubic; border: none;&quot; /></a><img src=&quot;http://rover.ebay.com/roveropen/0/e12050/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&quot; alt=&quot;&quot; style=&quot;border:0; height:1;&quot;/></td></tr></table></td></tr></table> <table id=&quot;area5Container&quot; width=&quot;100%&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; align=&quot;center&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; background-color:#f9f9f9&quot;>  <tr>    <td width=&quot;100%&quot; valign=&quot;top&quot;   style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none;&quot;>    <table id=&quot;PrimaryMessage&quot; width=&quot;600&quot; class=&quot;device-width&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; align=&quot;center&quot; bgcolor=&quot;#f9f9f9&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none;&quot;>      <tr><td valign=&quot;top&quot; class=&quot;secondary-headline&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; padding: 20px 0 5px;&quot;><h1 style=&quot;font-family: Helvetica, Arial, sans-serif; font-weight: normal; line-height: 15px; color: #808284; text-align: left; font-size: 13px; margin: 0 0 4px;&quot; align=&quot;left&quot;>New message from:<a href=&quot;http://rover.ebay.com/rover/0/e12050.m44.l1181/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&amp;loc=http%3A%2F%2Fpages.ebay.com%2Flink%2F%3Fnav%3Duser.view%26user%3Dandfen6%26globalID%3DEBAY-ENCA%26referrer%3Dhttp%253A%252F%252Frover.ebay.com%252Frover%252F0%252Fe12050.m44.l1181%252F7%253Feuid%253D68fe0bd048d04a84b6d8ef4046dde4cd%2526cp%253D1&quot; style=&quot;text-decoration: none; font-weight: bold; color: #336fb7;&quot;>andfen6</a><a href=&quot;http://rover.ebay.com/rover/0/e12050.m44.l1183/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&amp;loc=http%3A%2F%2Ffeedback.ebay.ca%2Fws%2FeBayISAPI.dll%3FViewFeedback%26userid%3Dandfen6%26ssPageName%3DSTRK%3AME%3AUFS&quot; style=&quot;text-decoration: none; color: #888888;&quot;>(5)</a></h1></td></tr>            <tr><td valign=&quot;top&quot; class=&quot;viewing-problem-block&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border-bottom-width: 1px; border-bottom-color: #f9f9f9; padding: 10px 0 30px; border-style: none none solid;&quot;>          <table width=&quot;600&quot; class=&quot;device-width&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none; border:0; cellpadding:0; cellspacing:0; align:center; bgcolor:#f9f9f9;&quot;>               <tr><td width=&quot;100%&quot; class=&quot;wrapText device-width&quot; valign=&quot;top&quot; style=&quot;overflow: hidden; border-collapse: collapse !important; border-spacing: 0 !important; border: none; display: inline-block; max-width:600px;&quot;><h3 style=&quot;font-family: Helvetica, Arial, sans-serif; font-weight: normal; line-height: 19px; color: #231f20; text-align: left; font-size: 14px; margin: 0 0 2px; font-weight:none;&quot; align=&quot;left&quot;><div id=&quot;UserInputtedText&quot;>Hi Kobo,<br /><br />As a buyer, I am interested....<br /><br />this is a test message</div></h3>                    <span style=&quot;color:#666666&quot;></span>				</td></tr>              <tr><td valign=&quot;top&quot; width=&quot;15&quot; height=&quot;15&quot; style=&quot;border-collapse: collapse !important; border-spacing: 20 !important; border: none;&quot;></td></tr>              <tr><td valign=&quot;top&quot; class=&quot;cta-block&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; padding: 5px 0 5px; border: none;&quot;><table align=&quot;left&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot; class=&quot;mobile-full-width&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none;&quot;><tr><td valign=&quot;top&quot; class=&quot;center cta-button primary-cta-button&quot; align=&quot;center&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; font-size: 14px; line-height: normal; font-weight: bold; box-shadow: 2px 3px 0 #e5e5e5; filter: progid:DXImageTransform.Microsoft.gradient( startColorstr=&apos;#0079bc&apos;, endColorstr=&apos;#00519e&apos;,GradientType=0 ); background-image: linear-gradient(to bottom,  #0079bc 0%,#00519e 100%); background-color: #0079bc; padding: 10px 17px; border: 1px solid #00519e;&quot; bgcolor=&quot;#0079bc&quot;><a href=&quot;http://rover.ebay.com/rover/0/e12050.m44.l1139/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&amp;loc=http%3A%2F%2Fcontact.ebay.ca%2Fws%2FeBayISAPI.dll%3FM2MContact%26requested%3Dandfen6%26qid%3D1291497258010%26redirect%3D0&quot; style=&quot;text-decoration: none; color: #ffffff; font-size: 14px; line-height: normal; font-weight: bold; font-family: Helvetica, Arial, sans-serif; text-shadow: 1px 1px 0 #00519e;&quot;><span style=&quot;padding: 0px 10px&quot;>Reply</span></a></td></tr></table>                </td></tr>           </table></td></tr></table>    <!--[if !mso]><!--><div id=&quot;V4PrimaryMessage&quot;  style=&quot;max-height: 0px; font-size: 0; overflow:hidden; display: none !important;&quot;><div><table border=&quot;0&quot; cellpadding=&quot;2&quot; cellspacing=&quot;3&quot; width=&quot;100%&quot;><tr><td><font style=&quot;font-size:10pt; font-family:arial, sans-serif; color:#000&quot;><strong>Dear rakutenkobo,</strong><br><br>Hi Kobo,<br /><br />As a buyer, I am interested....<br /><br />this is a test message<br><br></font><div style=&quot;font-weight:bold; font-size:10pt; font-family:arial, sans-serif; color:#000&quot;>- andfen6</div></td><td valign=&quot;top&quot; width=&quot;185&quot;><div></div></td></tr></table></div></div><!--<![endif]-->	</td>  </tr></table> <table id=&quot;area3Container&quot; width=&quot;100%&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; align=&quot;center&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color:#f9f9f9&quot;>    <tr>      <td width=&quot;100%&quot; valign=&quot;top&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none;&quot;><table width=&quot;100%&quot; height=&quot;7&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; align=&quot;center&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-image: url(&amp;#39;http://p.ebaystatic.com/aw/navbar/preHeaderBottomShadow.png&amp;#39;); background-repeat: repeat-y no-repeat; margin: 0; padding: 0&quot;>  <tr><td width=&quot;100%&quot; height=&quot;1&quot; valign=&quot;top&quot; align=&quot;center&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color: #dddddd;&quot;></td></tr>  <tr><td width=&quot;100%&quot; height=&quot;6&quot; valign=&quot;top&quot; align=&quot;center&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color: none;&quot;></td></tr></table>      </td>    </tr>  </table> <table id=&quot;area7Container&quot; width=&quot;100%&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; align=&quot;center&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color:#f9f9f9;&quot;>  <tr>    <td width=&quot;100%&quot; valign=&quot;top&quot;   style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none;&quot;>    <table width=&quot;600&quot; class=&quot;device-width&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; align=&quot;center&quot; bgcolor=&quot;#f9f9f9&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none;&quot;>            <tr><td valign=&quot;top&quot; align=&quot;center&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none; padding-right:20px;&quot;><h1 style=&quot;font-family: Helvetica, Arial, sans-serif; font-weight: bold; line-height: 22px; color: #808284; text-align: left; font-size: 16px; text-align: left; margin-top: 0px; border-style: none none solid; border-bottom-color: #dddddd; border-bottom-width: 1px;&quot; align=&quot;left&quot;>Get to know <a href=&quot;http://rover.ebay.com/rover/0/e12050.m3965.l1181/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&amp;loc=http%3A%2F%2Fpages.ebay.com%2Flink%2F%3Fnav%3Duser.view%26user%3Dandfen6%26globalID%3DEBAY-ENCA%26referrer%3Dhttp%253A%252F%252Frover.ebay.com%252Frover%252F0%252Fe12050.m3965.l1181%252F7%253Feuid%253D68fe0bd048d04a84b6d8ef4046dde4cd%2526cp%253D1&quot; style=&quot;text-decoration: none; color: #336fb7;&quot;>andfen6</a> </h1><table style=&quot;font-family: Helvetica, Arial, sans-serif; font-weight: normal; line-height: 19px; text-align: left; font-size: 14px; margin-bottom: 10px; padding-bottom: 10px;&quot; align=&quot;left&quot;><tr><td valign=&quot;top&quot; style=&quot;font-size: 20px; padding-left: 15px; padding-right: 5px;&quot;>&amp;bull;</td><td style=&quot;padding-bottom: 5px&quot;>Located: Toronto, ON, Canada</td></tr><tr><td valign=&quot;top&quot; style=&quot;font-size: 20px; padding-left: 15px; padding-right: 5px;&quot;>&amp;bull;</td><td style=&quot;padding-bottom: 5px&quot;>Member since: Dec 17, 2015</td></tr><tr><td valign=&quot;top&quot; style=&quot;font-size: 20px; padding-left: 15px; padding-right: 5px;&quot;>&amp;bull;</td><td style=&quot;padding-bottom: 5px&quot;>Positive Feedback: 100%</td></tr></table></td></tr></table></td></tr></table>  <table id=&quot;area10Container&quot; class=&quot;whiteSection&quot; width=&quot;100%&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; align=&quot;center&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color: #ffffff&quot;>  <tr>    <td width=&quot;100%&quot; valign=&quot;top&quot;   style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none;&quot;>    		<table width=&quot;600&quot; class=&quot;device-width&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; align=&quot;center&quot; bgcolor=&quot;#ffffff&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none;&quot;><tr><td valign=&quot;top&quot; class=&quot;viewing-problem-block&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border-bottom-width: 1px; border-bottom-color: #dddddd; padding: 40px 0 30px; border-style: none none solid;&quot;><p style=&quot;font-family: Helvetica, Arial, sans-serif; font-weight: normal; line-height: normal; color: #888888; text-align: left; font-size: 11px; margin: 0 0 10px;&quot; align=&quot;center&quot;>Only purchases on eBay are covered by the eBay purchase protection programs. Asking your trading partner to complete a transaction outside of eBay is not allowed.</p></td></tr></table>	</td>  </tr></table> <table id=&quot;area11Container&quot; class=&quot;whiteSection&quot; width=&quot;100%&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; align=&quot;center&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color: #ffffff&quot;><tr><td width=&quot;100%&quot; valign=&quot;top&quot;   style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none;&quot;>              <table width=&quot;600&quot; class=&quot;device-width&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; align=&quot;center&quot;   style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; border: none;&quot;><tr><td valign=&quot;top&quot; class=&quot;ebay-footer-block&quot; style=&quot;border-collapse: collapse !important; border-spacing: 0 !important; padding: 40px 0 60px; border: none;&quot;>   		<div id=&quot;ReferenceId&quot;><p style=&quot;font-family: Helvetica, Arial, sans-serif; font-weight: normal; line-height: normal; color: #888888; text-align: left; font-size: 11px; margin: 0 0 10px;&quot; align=&quot;left&quot;><strong>Email reference id: [#a05-c1pifaockd#]_[#68fe0bd048d04a84b6d8ef4046dde4cd#]</strong></p></div><p style=&quot;font-family: Helvetica, Arial, sans-serif; font-weight: normal; line-height: normal; color: #888888; text-align: left; font-size: 11px; margin: 0 0 10px;&quot; align=&quot;left&quot;>We don&apos;t check this mailbox, so please don&apos;t reply to this message. If you have a question, go to <a style=&quot;text-decoration: none; color: #555555;&quot; href=&quot;http://rover.ebay.com/rover/0/e12050.m1852.l6369/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&amp;loc=http%3A%2F%2Focsnext.ebay.ca%2Focs%2Fhome&quot; target=&quot;_blank&quot;>Help &amp; Contact</a>.</p>		    <p style=&quot;font-family: Helvetica, Arial, sans-serif; font-weight: normal; line-height: normal; color: #888888; text-align: left; font-size: 11px; margin: 0 0 10px;&quot; align=&quot;left&quot;>eBay sent this message to Nantha Gopalasamy (rakutenkobo). Learn more about <a style=&quot;text-decoration: none; color: #555555;&quot; href=&quot;http://rover.ebay.com/rover/0/e12050.m1852.l3167/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&amp;loc=http%3A%2F%2Fpages.ebay.ca%2Fhelp%2Faccount%2Fprotecting-account.html&quot; target=&quot;_blank&quot;>account protection</a>. eBay is committed to your privacy. Learn more about our <a style=&quot;text-decoration: none; color: #555555;&quot; href=&quot;http://rover.ebay.com/rover/0/e12050.m1852.l3168/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&amp;loc=http%3A%2F%2Fpages.ebay.ca%2Fhelp%2Fpolicies%2Fprivacy-policy.html&quot; target=&quot;_blank&quot;>privacy policy</a> and <a style=&quot;text-decoration: none; color: #555555;&quot; href=&quot;http://rover.ebay.com/rover/0/e12050.m1852.l3165/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&amp;loc=http%3A%2F%2Fpages.ebay.ca%2Fhelp%2Fpolicies%2Fuser-agreement.html&quot; target=&quot;_blank&quot;>user agreement</a>.</p><p style=&quot;font-family: Helvetica, Arial, sans-serif; font-weight: normal; line-height: normal; color: #888888; text-align: left; font-size: 11px; margin: 0 0 10px;&quot; align=&quot;left&quot;>&amp;copy;2016 eBay Inc., eBay International AG Helvetiastrasse 15/17 - P.O. Box 133, 3000 Bern 6, Switzerland</p></td></tr></table></td></tr></table></body></html>");
                {
                    server.Start();
                    Console.WriteLine("server started");
                    driver.Manage().Window.Maximize();
                    driver.Navigate().GoToUrl("http://localhost:7104/message/");
                    var element = driver.FindElement(By.Id("UserInputtedText"));
                    Console.WriteLine(element.Text);

                    for (int i = 0; i < 100; i++)
                    {
                        server.SetService("new content: " + i);
                        driver.Navigate().GoToUrl("http://localhost:7104/message/");
                        Console.WriteLine(driver.PageSource);
                    }
                }
            }

            // start async http server
            //HttpServerAsync.ListenAsync();
            //WebClient wc = new WebClient(); // Make a client request.
            //Console.WriteLine(wc.DownloadString
            //("http://localhost:51111/MyApp/Request.txt"));

            // local parser
            //LocalParser.Process();
        }
Пример #3
0
        private string ExecuteCommand(string url)
        {
            try
            {

                using (var phantom = new PhantomJSDriver())
                {
                    var indexFile = Server.MapPath("~/Scripts/PhantomJS/index.js");
                    var scriptSource = System.IO.File.ReadAllText(indexFile);
                    var script = phantom.ExecutePhantomJS(scriptSource);

                    phantom.Navigate().GoToUrl("https://www.bing.com");

                    phantom.FindElement(By.Id("sb_form_q")).SendKeys("learn2automate");

                    //Click on Search
                    phantom.FindElement(By.Id("sb_form_go")).Click();

                    Screenshot sh = phantom.GetScreenshot();
                    sh.SaveAsFile(@"C:\Temp.jpg", ImageFormat.Png);

                    phantom.Quit();
                }

            }
            catch (Exception ex)
            {
            }

            return string.Empty;
        }
Пример #4
0
        private static string GetJxsscResult(string drawNo)
        {
            var url = "http://data.shishicai.cn/jxssc/haoma/";

            var driver = new PhantomJSDriver { Url = url };
            driver.Navigate();

            // the driver can now provide you with what you need (it will execute the script)
            // get the source of the page
            var source = driver.PageSource;

            // fully navigate the dom
            var drawResultElements = driver.FindElementByClassName("newNum").FindElements(By.CssSelector("table[class='data_tab'] tbody tr"));
            var result = string.Empty;

            foreach (var draws in drawResultElements)
            {
                var drawElemnet = draws.Text.Split(' ');
                if (drawElemnet[0].Contains(drawNo))
                {
                    result = string.Join(",", drawElemnet.Select(o => o.ToString()).ToArray());
                    break;
                }
            }

            driver.Close();
            return result;
        }
Пример #5
0
        /// <summary>
        /// Starting point for the application.
        /// </summary>
        /// <param name="args"> The arguments passed in from the console. </param>
        public static void Main(string[] args)
        {
            PhantomJSDriverService service = PhantomJSDriverService.CreateDefaultService();
            service.IgnoreSslErrors = true;
            service.LoadImages = false;

            Console.WriteLine("gebruikersnaam");
            string gebruikersnaam = Console.ReadLine();
            Console.WriteLine("wachtwoord");
            string wachtwoord = Console.ReadLine();

            IWebDriver driver = new PhantomJSDriver(service);
            driver.Navigate().GoToUrl("https://mijn.ing.nl/internetbankieren/SesamLoginServlet");

            IWebElement gebruikersnaamElem = driver.FindElement(By.XPath("//div[@id='gebruikersnaam']/descendant::input"));
            gebruikersnaamElem.SendKeys(gebruikersnaam);
            IWebElement wachtwoordElem = driver.FindElement(By.XPath("//div[@id='wachtwoord']/descendant::input"));
            wachtwoordElem.SendKeys(wachtwoord);
            IWebElement button = driver.FindElement(By.CssSelector("button.submit"));
            button.Click();

            ((ITakesScreenshot)driver).GetScreenshot().SaveAsFile("ing.png", ImageFormat.Png);
            System.IO.File.WriteAllText("ing.html", driver.PageSource);

            driver.Quit();

            Console.WriteLine("We are done");
            Console.ReadKey();
        }
Пример #6
0
 public void GivenIHaveEnteredIntoTheCalculator(int p0)
 {
     var driver = new PhantomJSDriver{Url = @"http://www.google.com"};
     driver.Navigate();
     var searchBox = driver.FindElement(By.Name("q"));
     Assert.IsTrue(searchBox.Displayed);
     searchBox.SendKeys("Hello World");
     driver.Dispose();
 }
Пример #7
0
 public static void Process()
 {
     // works with local html page but has browser window
     //IWebDriver driver = new ChromeDriver();
     // not working with local html page
     IWebDriver driver = new PhantomJSDriver();
     driver.Navigate().GoToUrl("file://c:/Work/Workspace/SeleniumTutorialNet/SeleniumTutorialNet/empty-page.html");
     //driver.Navigate().GoToUrl("http://www.google.ca");
     WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(5));
     Console.WriteLine("\n\n"+driver.Title);
     //Console.WriteLine("\n\n" + driver.PageSource);
 }
        public void IndexPage_IsPresent()
        {
            using (IWebDriver driver = new PhantomJSDriver())
            {
                driver.Navigate().GoToUrl(_websiteUrl);

                By tableSelector = By.CssSelector("table#hobbitsList tr td");
                WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
                wait.Until(ExpectedConditions.ElementIsVisible(tableSelector));

                IWebElement element = driver.FindElement(tableSelector);

                Assert.True(element.Displayed);
            }
        }
Пример #9
0
        public List<Property> Properties(string query)
        {
            var results = new List<Property>();
            try
            {
                var driver = new PhantomJSDriver();

                driver.Navigate().GoToUrl(query);
                var body = driver.FindElementByTagName("body");
                Console.Write(body.Text);
                Thread.Sleep(2000);
                var articles = driver.FindElementsByTagName("article");

                foreach (var webElement in articles)
                {
                    try
                    {
                        var newProperty = new Property
                        {
                            Thumbnail = webElement.FindElement(By.ClassName("photo")).GetAttribute("data-photourl"),
                            Link = webElement.FindElement(By.ClassName("hdp-link")).GetAttribute("href")
                        };
                        var fullAddress = webElement.FindElement(By.ClassName("image-loaded")).GetAttribute("alt");
                        var split = fullAddress.Split(',');
                        var splitCount = split.Count();
                        var city = split[splitCount - 2];
                        var state = split.Last();
                        newProperty.Address = split[0];
                        newProperty.City = city;
                        newProperty.State = state;
                        results.Add(newProperty);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("Error searching Zillow. " + ex.ToString());
                    }
                }

                driver.Quit();

                return results.ToList();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error searching Zillow. " + ex.ToString());
            }
            return null;
        }
Пример #10
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            var driverService = PhantomJSDriverService.CreateDefaultService();
            driverService.HideCommandPromptWindow = true;

            var webDriver = new PhantomJSDriver(driverService);
            webDriver.Navigate().GoToUrl("http://www.udebug.com/UVa/10812");
            IWebElement inputBox = webDriver.FindElement(By.Id("edit-input-data"));
            inputBox.SendKeys("3\n2035415231 1462621774\n1545574401 1640829072\n2057229440 1467906174");
            IWebElement submitButton = webDriver.FindElement(By.Id("edit-output"));
            submitButton.Click();
            string answer = webDriver.PageSource;
            int begin = answer.IndexOf("<pre>") + 5;
            answer = answer.Substring(begin, answer.IndexOf("</pre>") - begin);
            webDriver.Close();
            MessageBox.Show(answer);
        }
Пример #11
0
 public static void OpenPhantomJs()
 {
     // initialize a WebDriver instance
     IWebDriver driver = new PhantomJSDriver();
     // load google search page
     driver.Navigate().GoToUrl("https://www.google.ca");
     // print title
     Console.WriteLine("Page title: " + driver.Title);
     // enter search word and submit
     IWebElement element = driver.FindElement(By.Name("q"));
     element.SendKeys("Cheese");
     element.Submit();
     // print title
     Console.WriteLine("Page title: " + driver.Title);
     // quit the driver
     driver.Quit();
 }
Пример #12
0
        public void WithoutPassenger()
        {
            using (var webdriver = new PhantomJSDriver())
            {
                webdriver.Navigate().GoToUrl("http://www.amazon.co.uk");
                var myElement = webdriver.FindElementById("twotabsearchtextbox");

                myElement.Click();
                myElement.SendKeys("Game of thrones");

                var goButton = webdriver.FindElementByClassName("nav-searchbar");
                goButton.Submit();

                var allH2s = webdriver.FindElementsByTagName("h2");

                var oneWithGameOfThrones = allH2s.Where(x => x.Text == "Game of Thrones - Season 4");

                Assert.That(oneWithGameOfThrones, Is.Not.Null);
            }
        }
Пример #13
0
        protected override byte[] DownloadImpl()
        {
            byte[] bytes = new byte[0];

            var driverService = PhantomJSDriverService.CreateDefaultService();
            driverService.HideCommandPromptWindow = true;
            driverService.LoadImages = false;
            driverService.IgnoreSslErrors = true;

            if(Proxy != null)
            {
                driverService.ProxyType = "http";
                driverService.Proxy = Proxy.ToString();
            }

            PhantomJSDriver phantom = null;
            try
            {
                phantom = new PhantomJSDriver(driverService);
                phantom.Navigate().GoToUrl(Url);

                if (!String.IsNullOrEmpty(_cssElement))
                {
                    var wait = new WebDriverWait(phantom, TimeSpan.FromSeconds(_cssTimeout));
                    wait.Message = "Couldn't find element in page";
                    wait.Until(drv => drv.FindElement(By.CssSelector(_cssElement)));
                }

                string html = phantom.PageSource;
                bytes = Encoding.UTF8.GetBytes(html);
            }
            finally
            {
                if (phantom != null)
                    phantom.Dispose();
            }

            return bytes;
        }
Пример #14
0
        public void DownloadStroy(string url)
        {
            if (File.Exists(OutputFile))
            {
                File.Delete(OutputFile);
            }

            WriteFile("<!DOCTYPE html><html xmlns=\"http://www.w3.org/1999/xhtml\"><head><meta charset=\"utf-8\"/></head><body>");

            IWebDriver driver = new PhantomJSDriver();
            driver.Navigate().GoToUrl(url);

            var isTextAvailable = true;
            while (isTextAvailable)
            {
                Log($"Reading page: {driver.Title}");

                var contentDiv = driver.FindElement(By.ClassName("b-story-body-x"));
                WriteFile(contentDiv.GetInnerHtml());

                var nextButton = driver.TryFindElement(By.CssSelector("a.b-pager-next"));
                if (nextButton != null)
                {
                    nextButton.Click();
                    Log("Navigating to next page");
                }
                else
                {
                    isTextAvailable = false;
                }
            }

            WriteFile("</body></html>");

            driver.Quit();
        }
Пример #15
0
        public Property Property(Property property)
        {
            try
            {
                var query = string.Format("http://www.zillow.com/homedetails/{0}_zpid/", property.Zpid);
                var driver = new PhantomJSDriver();

                driver.Navigate().GoToUrl(query);
                var body = driver.FindElementByTagName("body");
                Console.Write(body.Text);
                Thread.Sleep(2000);
                var webElement = driver.FindElement(By.ClassName("main-wrapper"));
                property.Link = query;

                    try
                    {
                        var thumbnailElem = webElement.FindElement(By.ClassName("hip-photo"));
                        if (thumbnailElem != null)
                        {
                            property.Thumbnail = thumbnailElem.GetAttribute("src");
                        }

                        var fullAddressElem = webElement.FindElement(By.TagName("h1"));
                        if (fullAddressElem != null)
                        {
                            var split = fullAddressElem.Text.Split(',');
                            property.Address = split[0];
                        }

                        var cityElem = webElement.FindElement(By.ClassName("addr_city"));
                        if (cityElem != null)
                        {
                            var split1 = cityElem.Text.Split(',');
                            var split2 = split1[1].Split(' ');
                            property.City = split1[0];
                            property.State = split2[1];
                        }

                        var priceElem = webElement.FindElement(By.ClassName("main-row"));
                        if (priceElem != null)
                        {
                            if (priceElem.Text.Contains("$"))
                            {
                                property.Price = Convert.ToDouble(priceElem.Text.Replace("$", "").Replace("from: ", ""));
                            }
                        }

                        var valueChangeElem = webElement.FindElement(By.ClassName("zest-change"));
                        if (valueChangeElem != null)
                        {
                            var split = valueChangeElem.Text.Split(' ');
                            property.ValueChange = Convert.ToDouble(split[0].Replace("$", "").Replace(",", ""));
                        }

                        var zestimateElms = webElement.FindElements(By.ClassName("zest-value"));
                        foreach (var zestimateElm in zestimateElms)
                        {
                            var text = zestimateElm.Text;
                            if (text.Contains("/mo"))
                            {
                                property.RentZestimate = Convert.ToDouble(text.Replace("/mo", "").Replace("$", ""));
                            }
                            else if(!text.Contains("X"))
                            {
                                property.Zestimate = Convert.ToDouble(text.Replace("$", ""));
                            }
                        }

                        var zsgListUl = webElement.FindElements(By.ClassName("zsg-list_square"));
                        foreach (var element in zsgListUl)
                        {
                            var lis = element.FindElements(By.TagName("li"));
                            foreach (var li in lis)
                            {
                                var text = li.Text;
                                if (text.Contains("Family"))
                                {
                                    property.PropertyType = text;
                                }
                                if (text.Contains("Built in"))
                                {
                                    var modifiedBuiltIn = text.Replace("Built in ", "");
                                    property.YearBuilt = Convert.ToInt32(modifiedBuiltIn);
                                }
                                if (text.Contains("Lot"))
                                {
                                    var modifiedSqft = text.Replace("Lot: ", "").Replace(" sqft", "").Replace(",","");
                                    if (modifiedSqft.Contains("acres"))
                                    {
                                        modifiedSqft = modifiedSqft.Replace(" acres", "");
                                        property.LotSizeSqFt = (int) (Convert.ToDouble(modifiedSqft)*43560);
                                    }
                                    else
                                    {
                                        property.LotSizeSqFt = Convert.ToInt32(modifiedSqft);
                                    }
                                }
                                if (text.Contains("Unit count: "))
                                {
                                    property.NumUnits = Convert.ToInt32(text.Replace("Unit count: ", ""));
                                }
                                if (text.Contains("on Zillow"))
                                {
                                    var textSplit = text.Split(' ');
                                    property.DaysOnZillow = Convert.ToInt32(textSplit[0]);
                                }
                            }
                        }

                        property.AnnualTaxes = property.Price * .01;

                        var addrBbsElms = webElement.FindElements(By.ClassName("addr_bbs"));
                        foreach (var addrBbs in addrBbsElms)
                        {
                            var text = addrBbs.Text;
                            if (text.Contains("sqft"))
                            {
                                var splitSqft = text.Split(' ');
                                property.FinishedSqFt = Convert.ToInt32(splitSqft[0].Replace(",",""));
                            }
                            if (text.Contains("bath"))
                            {
                                var formatedBaths = text.Replace("bath", "").Replace("--", "").Replace(" ", "").Replace("s","");
                                if (formatedBaths != "")
                                {
                                    property.Bathrooms = Convert.ToInt32(formatedBaths);
                                }
                            }
                            if (text.Contains("bed"))
                            {
                                var formattedBds = text.Replace("bed", "").Replace("--", "").Replace(" ", "").Replace("s", "");
                                if (formattedBds != "")
                                {
                                    property.Bedrooms = Convert.ToInt32(formattedBds);
                                }
                            }
                        }

                        var statusElem = webElement.FindElement(By.ClassName("status-icon-row"));
                        if (statusElem != null)
                        {
                            property.Status = statusElem.Text;
                        }

                        var descElem = webElement.FindElement(By.ClassName("notranslate"));
                        if (descElem != null)
                        {
                            property.HomeDescription = descElem.Text;
                        }

                        var insuranceElem = webElement.FindElement(By.Id("home-ins-out"));
                        if (insuranceElem != null)
                        {
                            property.Insurance = Convert.ToDouble(insuranceElem.Text.Replace("$", ""));
                        }

                        property.LoanAmount = property.Price * .80;
                        property.LoanType = "30 year fixed";
                        property.LoanTerm = 360;

                        //var interestElem = webElement.FindElements(By.XPath("//*[@id='zmm-calc-input-program']/option"));
                        //if (interestElem != null)
                        //{
                        //    newProperty.InterestRate = Convert.ToDouble(interestElem[0].Text);
                        //}

                        property.DownPayment = property.Price * .20;

                        var monthlyPaymentElem = webElement.FindElement(By.Id("pi-payment-out"));
                        if (monthlyPaymentElem != null)
                        {
                            property.DebtServicePI = Convert.ToDouble(monthlyPaymentElem.Text.Replace("$", ""));
                        }

                        property.ClosingCosts = property.Price * .025;
                        if (property.CurrentRent < 1)
                        {
                            property.CurrentRent = property.RentZestimate;
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("Error searching Zillow. " + ex.ToString());
                    }

                driver.Quit();
                return property;
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error searching Zillow. " + ex.ToString());
            }
            return null;
        }
Пример #16
0
        public ActionResult SuperTest()
        {
            IWebDriver driver = new PhantomJSDriver();
            driver.Navigate().GoToUrl("http://www.google.com");
            var i = driver.FindElement(By.Name("q"));
            i.SendKeys("Lol");
            i.Submit();
            i = driver.FindElement(By.Name("q"));
            var v = i.GetAttribute("value");
            ViewBag.ResultValue = v;

            return View();
        }
Пример #17
0
        /// <summary>
        /// Prerequisite  - .
        /// </summary>
        public void Logger()
        {
            try
            {
                //reading the log file generated by the coded ui by launching the phantomjs & generating different logs
                
                string totaltime, testOutcome = "Passed";
                List<IWebElement> tags;
                IWebElement Element;
                string defaultSplunkLogDirectory = null;
                string splunkLogPath = this.SplunkLogPath();
                string testResultsDirectory = LogFilePath();
                //  string SplunkLogPath = this.SplunkLogPath;
                this.Testcaseinfo = new TestCaseInfo(this.GetType().GetMethod(TestContext.TestName), this);
                Testcaseinfo.StartTime = DateTime.Now;
                IWebDriver driver = new PhantomJSDriver("Externals");
                driver.Navigate().GoToUrl("file:///" + testResultsDirectory);
                tags = driver.FindElements(By.CssSelector(".g-h.passed")).ToList();

                try
                {
                    Element = driver.FindElement(By.CssSelector(".g-h.failed"));
                    IWebElement exception = driver.FindElement(By.ClassName("e-m"));
                    tags.AddRange(driver.FindElements(By.CssSelector(".g-h.failed")));
                    tags.Add(exception);
                }
                catch
                {
                    Element = null;
                }
                if (Element != null)
                {
                    testOutcome = "Failed";
                    Testcaseinfo.TestOutCome = testOutcome;
                }
                else
                {
                    Testcaseinfo.TestOutCome = testOutcome;
                }

                //Create Directoory
                string logDirectory = "C:\\TestLog\\" + DateTime.Now.ToString("yyyy_MM_dd") + "\\Result_" + Testcaseinfo.TestName;
                if (splunkLogPath.Equals("null"))
                {
                    defaultSplunkLogDirectory = "C:\\TestLog\\SplunkLogs";
                }
                else
                {
                    defaultSplunkLogDirectory = splunkLogPath;
                }
                DirectoryInfo directory = new DirectoryInfo(logDirectory);
                if (!directory.Exists)
                {
                    directory.Create();
                }
                DirectoryInfo splunklog = new DirectoryInfo(defaultSplunkLogDirectory);
                if (!splunklog.Exists)
                {
                    splunklog.Create();
                }
                DirectoryInfo temp = new DirectoryInfo("C:\\Temp");
                if (!temp.Exists)
                {
                    directory.Create();
                }

                if (File.Exists("C:\\Temp\\Result.txt"))
                {
                    File.Delete("C:\\Temp\\Result.txt");
                }

                foreach (IWebElement element in tags)
                {
                    string value = element.GetAttribute("textContent").Remove(element.GetAttribute("textContent").Length - 8);

                    if (Testcaseinfo.TestName == null)
                    {
                        totaltime = element.GetAttribute("textContent").Substring(element.GetAttribute("textContent").Length - 8); ;
                        Testcaseinfo.TestName = value;
                    }
                    else
                    {
                        Logger log = new Logger();

                        log.GenerateLog(value);
                    }
                }


                // Genrating splunk log
                SplunkXmlTestRunReport splunkxmltestrunreport = new SplunkXmlTestRunReport();

                splunkxmltestrunreport.Generate(Testcaseinfo, defaultSplunkLogDirectory);

                //generating xml log
                XmlTestRunReport xmlrunreport = new XmlTestRunReport();

                xmlrunreport.Generate(Testcaseinfo, logDirectory);

                //Html log
                File.Copy(testResultsDirectory, logDirectory + "\\Result.Html", true);

                //Json log for Future

                // Killl the PhantomJs
                Process[] processs = Process.GetProcessesByName("PhantomJS");
                if (processs.Count() > 0)
                {
                    foreach (var process in processs)
                    {
                        process.Kill();
                    }
                }
            }
            catch(Exception ex)
            {
                Logger log = new Logger();

                log.GenerateLog(TestContext.TestResultsDirectory);
                log.GenerateLog(TestContext.TestRunResultsDirectory);
                log.GenerateLog(TestContext.TestLogsDir);
                log.GenerateLog(TestContext.ResultsDirectory);
                DirectoryInfo directory = new DirectoryInfo(this.TestContext.TestResultsDirectory);
                string fullPath = directory.GetFiles("*.html").First().FullName;
                log.GenerateLog(fullPath);
            }
        }
Пример #18
0
        public void ScrapeAdds(string url)
        {
            var service = PhantomJSDriverService.CreateDefaultService();
             service.HideCommandPromptWindow = true;

            var driver = new PhantomJSDriver(service);
            List<string> categories = new List<string>();
            List<string> Links = new List<string>();
            List<string> Images = new List<string>();
            List<string> Titles = new List<string>();
            service.IgnoreSslErrors = true;
            service.LoadImages = false;
            service.ProxyType = "none";
            try
            {
                driver.Navigate().GoToUrl(url);
                driver.GetScreenshot().SaveAsFile("image1.png", ImageFormat.Png);
                IWebElement body = driver.FindElement(By.TagName("head"));
                //IWebElement body = driver.FindElement(By.TagName("body"));
                //string pageSource = body.ToString();
                ReadOnlyCollection<IWebElement> getCategories = driver.FindElements(By.XPath("//ul[@id='menu-menu_main']/li/a"));
                foreach(var cat in getCategories)
                {
                    string s1 = cat.GetAttribute("href").ToString();
                    categories.Add(s1);
                }

                foreach (var catUrl in categories)
                {
                    driver.Navigate().GoToUrl(catUrl);
                    ReadOnlyCollection<IWebElement> pgNumber = driver.FindElements(By.XPath("//span[@class='pages']"));
                    string pgnum = pgNumber[0].GetAttribute("outerText");
                    int pageNumber = int.Parse(pgnum.Split(' ')[3]);
                    for (int i = 1; i < pageNumber; i++)
                    {
                        string categUrl = catUrl;
                        driver.Navigate().GoToUrl(categUrl);
                        ReadOnlyCollection<IWebElement> urls = driver.FindElements(By.XPath("//a[@itemprop='url']"));
                        ReadOnlyCollection<IWebElement> image = driver.FindElements(By.XPath("//img[@class='entry-thumb']"));
                        foreach (var v1 in urls)
                        {
                            string link = v1.GetAttribute("href");
                            string title = v1.GetAttribute("title");
                            string img = v1.GetAttribute("src");
                            Links.Add(link);
                        }

                        foreach (var v2 in image)
                        {

                            string img = v2.GetAttribute("src");
                            Images.Add(img);
                        }
                        categUrl=categUrl+  "page / "+i+"/";

                    }

                }

            }
            catch(Exception ex)
            { }
        }
Пример #19
0
        // get data from website using webdriver and save its contents into given IWebElement arguments.
        void fetchData(ref PhantomJSDriver driver, ref IWebElement myContent, ref IWebElement bidDetails, ref string[] enteredData)
        {
            driver = getWebBrowserDriverInit();
            string market = enteredData[0];
            string enteredDateFrom = enteredData[1];
            string enteredDateTo = enteredData[2];

            Exception tmpEx = null; // for possible exception recognition

            try
            {
                driver.Navigate().GoToUrl("https://kapalk1.mavir.hu/kapar/lt-publication.jsp?locale=en_GB");

                // TODO edit/delete if needed - this is not best approach (webpage can change)
                if (!(driver.Title.CompareTo("Kapar") == 0))
                {
                    driver.Quit();
                    throw new Exception("Error, webpage is not accessable or there is something wrong with your connection.");
                }

                driver.FindElementByXPath("/html/body/table/tbody/tr[2]/td/table/tbody/tr[2]/td[2]/div/table/tbody/tr/td[2]/input").Clear();

                driver.FindElementByXPath("/html/body/table/tbody/tr[2]/td/table/tbody/tr[2]/td[2]/div/table/tbody/tr/td[2]/input").SendKeys(enteredDateFrom); //SendKeys("12/4/2015");

                driver.FindElementByXPath("/html/body/table/tbody/tr[2]/td/table/tbody/tr[2]/td[2]/div/table/tbody/tr/td[4]/input").Clear();
                driver.FindElementByXPath("/html/body/table/tbody/tr[2]/td/table/tbody/tr[2]/td[2]/div/table/tbody/tr/td[4]/input").SendKeys(enteredDateTo); //SendKeys("12/10/2015");

                driver.FindElementByXPath("/html/body/table/tbody/tr[2]/td/table/tbody/tr[2]/td[2]/div/table/tbody/tr/td[6]/select").SendKeys(market); //SendKeys("All");

                driver.FindElementByXPath("/html/body/table/tbody/tr[2]/td/table/tbody/tr[2]/td[2]/div/table/tbody/tr/td[8]/button").Click();

                WebDriverWait waitForContent = new WebDriverWait(driver, TimeSpan.FromSeconds(60));
                myContent = waitForContent.Until<IWebElement>((d) =>
                {
                    return d.FindElement(By.XPath("/html/body/table/tbody/tr[3]/td/table"));
                });

                // xpath for 1st row in table
                driver.FindElementByXPath("/html/body/table/tbody/tr[3]/td/table/tbody/tr[2]/td[21]/a").Click();

                WebDriverWait waitForBidDetails = new WebDriverWait(driver, TimeSpan.FromSeconds(60));
                bidDetails = waitForContent.Until<IWebElement>((d) =>
                {
                    return d.FindElement(By.XPath("//html/body/div/div/table/tbody/tr[2]/td[2]/div/div/table/tbody/tr[1]/td/table"));
                });

            }
            catch (Exception e)
            {
                tmpEx = e;
            }

            if(tmpEx != null)
                throw new Exception(tmpEx.Message);
        }
        /// <summary>
        /// Scraper statistik for data
        /// </summary>
        /// <returns>Liste af statistik-objekter</returns>
        public List<Politistatistik> ScrapeStatistik()
        {
            List<Politistatistik> politistatistik = new List<Politistatistik>();
            try
            {
                int aarsTal = 2007;
                using (IWebDriver webDriver = new PhantomJSDriver())
                {
                    webDriver.Navigate().GoToUrl("http://www.politistatistik.dk/parameter.aspx?id=27");

                    webDriver.FindElement(By.XPath("//*[@id='geo00']/optgroup/option[8]")).Click();
                    webDriver.FindElement(By.XPath("//*[@id='kriminalitet01']/optgroup[2]/option[5]")).Click();
                    webDriver.FindElement(By.XPath("//*[@id='rightCloBaggr']/div[5]/div[3]/div[2]/input")).Click();
                    foreach (var aar in webDriver.FindElements(By.XPath("//*[@name='periodeYear']")))
                    {
                        aar.Click();
                    }
                    webDriver.FindElement(By.XPath("//*[@id='rightCol']/div[2]/div/div[3]/img")).Click();
                    webDriver.SwitchTo().Window(webDriver.WindowHandles.Last());

                    foreach (var item in webDriver.FindElements(By.ClassName("dataitem")))
                    {
                        politistatistik.Add(new Politistatistik(aarsTal++, item.Text));
                    }
                }
                List<Politistatistik> list = politistatistik.ToList();
                TraceHjaelp(new[] { "" }, list.ToString());
                return list;
            }
            catch (Exception) {}
            return politistatistik.ToList();
        }
Пример #21
0
    public void ScheduleGET()
    {
        var driverService = PhantomJSDriverService.CreateDefaultService();
        driverService.HideCommandPromptWindow = true; // Disables verbose phantomjs output
        IWebDriver driver = new PhantomJSDriver(driverService);
        //IWebDriver driver = new FirefoxDriver(); // Debug with firefox.

        Console.WriteLine("Logging into Office 365.");
        driver.Navigate().GoToUrl("https://wegmans.sharepoint.com/resources/Pages/LaborPro.aspx");
        if (driver.Title.ToString() == "Sign in to your account")
        {
            IWebElement loginentry = driver.FindElement(By.XPath("//*[@id='cred_userid_inputtext']"));
            loginentry.SendKeys(Username);
            IWebElement rememberme = driver.FindElement(By.XPath("//*[@id='cred_keep_me_signed_in_checkbox']"));
            rememberme.Click();
        }

        WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30));
        try { wait.Until((d) => { return (d.Title.ToString().Contains("Sign In") || d.Title.ToString().Contains("My Schedule")); }); } // Sometimes it skips the second login page.
        catch (WebDriverTimeoutException)
        {
            driver.Quit();
            throw new ScheduleGETException("Did not recieve an appropriate response from the Sharepoint server. The connection most likely timed out.");
        }
        Console.WriteLine("Logging into Sharepoint.");

        if (driver.Title.ToString() == "Sign In")
        {
            try { wait.Until((d) => { return (d.FindElement(By.XPath("//*[@id='passwordInput']"))); }); }
            catch (Exception)
            {
                driver.Quit();
                throw new ScheduleGETException("Password input box did not load correctly.");
            }
            IWebElement passwordentry = driver.FindElement(By.XPath("//*[@id='passwordInput']"));
            password = ConvertToUnsecureString(securePwd);
            passwordentry.SendKeys(password);
            ClearPassword();
            passwordentry.Submit();
        }

        try { wait.Until((d) => { return (d.Title.ToString().Contains("Sign In") || d.Title.ToString().Contains("My Schedule")); }); } // Checks to see if the password was incorrect.
        catch (WebDriverTimeoutException)
        {
            driver.Quit();
            throw new ScheduleGETException("Did not recieve an appropriate response from the Sharepoint server. The connection most likely timed out.");
        }
        if (driver.Title.ToString() == "Sign In")
        {

            IWebElement error = driver.FindElement(By.XPath("//*[@id='error']"));
            string errorString = error.Text.ToString();
            if (errorString.Contains("Incorrect user ID or password"))
            {
                while (driver.Title.ToString() == "Sign In")
                {
                    IWebElement usernameentry = driver.FindElement(By.XPath("//*[@id='userNameInput']"));
                    IWebElement passwordentry = driver.FindElement(By.XPath("//*[@id='passwordInput']"));
                    usernameentry.Clear();
                    passwordentry.Clear();
                    Console.WriteLine("You seem to have entered the wrong username or password.");
                    GetLoginCreds();
                    Console.WriteLine("Trying again...");
                    usernameentry.SendKeys(Username);
                    password = ConvertToUnsecureString(securePwd);
                    passwordentry.SendKeys(password);
                    ClearPassword();
                    passwordentry.Submit();
                }
                SaveLoginCreds();
            }
            else
            {
                Console.WriteLine("An unexpected error has occured with the webpage.");
                Console.WriteLine(errorString);
                driver.Quit();
                throw new ScheduleGETException("An unexpected error has occured with the webpage.");
            }
        }

        Console.WriteLine("Waiting for LaborPro...");
        int retries = 2;
        while (true) // Retry because this error can be solved by a simple page reload.
        {
            try { wait.Until((d) => { return (d.SwitchTo().Frame(0)); }); break; } // Waits for the inline frame to load.
            catch (WebDriverTimeoutException)
            {
                Console.WriteLine("LaborPro link's inline frame was not generated properly.");
                Console.WriteLine("Reloading the page...");
                driver.Navigate().Refresh();
                retries--;
                if (retries <= 0)
                {
                    driver.Quit();
                    throw new ScheduleGETException("LaborPro link's inline frame was not generated properly.");
                }

            }
        }

        string BaseWindow = driver.CurrentWindowHandle;
        try { wait.Until((d) => { return (d.FindElement(By.XPath("/html/body/a"))); }); } // Waits until javascript generates the SSO link.
        catch (Exception)
        {
            if (driver.Title.ToString().Contains("Sign In")) // We were redirected to the sign-in page once again, so let's fill it out again...
            {
                IWebElement usernameentry = driver.FindElement(By.XPath("//*[@id='userNameInput']"));
                IWebElement passwordentry = driver.FindElement(By.XPath("//*[@id='passwordInput']"));
                usernameentry.Clear();
                passwordentry.Clear();
                usernameentry.SendKeys(Username);
                password = ConvertToUnsecureString(securePwd);
                passwordentry.SendKeys(password);
                ClearPassword();
                passwordentry.Submit();
            }
            else
            {
                driver.Quit();
                throw new ScheduleGETException("LaborPro SSO Link was not generated properly.");
            }
        }

        IWebElement accessschedule = driver.FindElement(By.XPath("/html/body/a"));
        accessschedule.Click();
        string popupHandle = string.Empty;
        ReadOnlyCollection<string> windowHandles = driver.WindowHandles;

        foreach (string handle in windowHandles)
        {
            if (handle != driver.CurrentWindowHandle)
            {
                popupHandle = handle;
                break;
            }
        }
        driver.SwitchTo().Window(popupHandle);

        Console.WriteLine("Accessing LaborPro.");
        try { wait.Until((d) => { return (d.Title.ToString().Contains("Welcome")); }); }
        catch (WebDriverTimeoutException)
        {
            throw new ScheduleGETException("Did not properly switch to LabroPro Window.");
        }
        Schedules.Add(driver.PageSource.ToString());
        for (int i = 0; i < 2; i++) // Clicks "Next" and gets the schedules for the next two weeks.
        {
            driver.FindElement(By.XPath("//*[@id='pageBody']/form/table[2]/tbody/tr[2]/td/table/tbody/tr[2]/td/table/tbody/tr/td/div/table[1]/tbody/tr/td[1]/a[3]")).Click();
            Schedules.Add(driver.PageSource.ToString());
        }
        ClearPassword(); // We don't need the password anymore, so let's not keep it laying around.
        driver.Quit();
        Console.WriteLine("Got your Schedule.");
    }
Пример #22
0
        public void Adblade(string url, PhantomJSDriver driver, string path1, string path2, string path3, ad_network adN, string agent)
        {
            Stopwatch watch = new Stopwatch();
            watch.Start();
            var service1 = PhantomJSDriverService.CreateDefaultService();
            service1.HideCommandPromptWindow = true;
            var driver1 = new PhantomJSDriver(service1);
            List<string> adIds = new List<string>();
            List<string> adUrls = new List<string>();
            List<string> adImages = new List<string>();
            List<string> adTitle = new List<string>();
            List<string> imgwidth = new List<string>();
            List<string> imgheight = new List<string>();
            try
            {
            ReadOnlyCollection<IWebElement> getAdds = driver.FindElements(By.XPath(path1));
            //NetworkFunctions ns = new NetworkFunctions();
            List<NetworkFunctions> List = new List<NetworkFunctions>();

            foreach (var v1 in getAdds)
            {
                try
                {
                    string s2 = v1.GetAttribute("href");

                    try
                    {

                        driver1.Navigate().GoToUrl(s2);
                        //driver.GetScreenshot().SaveAsFile("image3.png", ImageFormat.Png);
                        IWebElement geturl = driver1.FindElement(By.XPath("//meta[@property='og:url']"));
                        string content = geturl.GetAttribute("content");
                        adUrls.Add(content);
                    }
                    catch (Exception ex)
                    {
                        adUrls.Add(s2);
                    }
                }
                catch
                { }
                // ns.adUrl = s2;
                //List.Add(ns);
                try
                    {
                        string s4 = v1.GetAttribute("outerText");
                        adTitle.Add(s4);
                        // ns.adTitle = s4;
                        //List.Add(ns);
                    }
                    catch
                    { }
                }
            ReadOnlyCollection<IWebElement> getImages = driver.FindElements(By.XPath(path2));
                foreach (var v2 in getImages)
                {//http://staticd.cdn.adblade.com/banners/images/298x224/4365_548f126ed8024.jpg
                    string s3 = v2.GetAttribute("src");
                    if (s3 != null)
                    {
                        adImages.Add(s3);
                        //ns.adImage = s3;
                        //List.Add(ns);
                        s3 = s3.Split('/')[5];
                        string width = s3.Split('x')[0];
                        string height = s3.Split('x')[1];
                        imgwidth.Add(width);
                        imgheight.Add(height);

                    }

                }
                ReadOnlyCollection<IWebElement> getID = driver.FindElements(By.XPath(path3));
                foreach (var v3 in getID)
                {

                    try
                    {
                        string v7 = v3.GetAttribute("data-adid");
                        if (v7 != null)
                        {
                            adIds.Add(v7);
                            //ns.adId = v7.Trim();
                            // List.Add(ns);
                        }
                    }
                    catch { }

                }

                watch.Stop();
                string time = watch.Elapsed.ToString();
                if (adIds.Count == adImages.Count && adIds.Count == adUrls.Count)
                {
                    _form1.combineAdd(url, adIds, adUrls, adImages, adTitle, imgwidth, imgheight, adN, agent, time);

                }
            }

            catch (Exception)
            { }
            driver.Quit();
            driver.Dispose();
            driver1.Quit();
            driver1.Dispose();
            adIds = null;
            adUrls = null;
            adImages = null;
            adTitle = null;
        }
Пример #23
0
        public void LoadData()
        {
            IWebDriver webDriver = null;
            State currentState = State.Ready;

            try
            {
                try { webDriver = new PhantomJSDriver(DriverPath); }
                catch (WebDriverException exc)
                {
                    throw new DriverStartupException("Impossibile avviare il web driver", exc);
                }

                webDriver.Navigate().GoToUrl(LoginUrl);
                Timer.Wait(2);
                currentState = State.Login;

                //Eseguo login
                IWebElement t_username = webDriver.FindElement(By.Id("username-id"));
                IWebElement t_password = webDriver.FindElement(By.Id("pwd-id"));
                IWebElement accesso = webDriver.FindElement(By.Name("login"));

                t_username.SendKeys(Username);
                t_password.SendKeys(Password);
                accesso.Click();
                Timer.Wait(3);

                webDriver.Navigate().GoToUrl(ReportUrl);
                Timer.Wait(3);

                //Verifico sia presente il bottone di logout, per essere sicuro di essere loggato
                try { webDriver.FindElement(By.CssSelector(".logout.btn.btn3d.tbbtn")); }
                catch (Exception)
                {
                    throw new ApplicationException("Login in Remedy non riuscito");
                }
                currentState = State.LoggedIn;

                //Inizio ricerca
                IWebElement ricercaAvanzata = webDriver.FindElement(By.Id("TBadvancedsearch"));
                IWebElement queryInput = webDriver.FindElement(By.Id("arid1005"));
                IWebElement avviaRicerca = webDriver.FindElement(By.Id("TBsearchsavechanges"));

                ricercaAvanzata.Click();
                Timer.Wait(2);
                queryInput.SendKeys(ReportQuery);
                Timer.Wait(1);
                avviaRicerca.Click();
                Timer.Wait(10);

                IWebElement selezionaTicket = webDriver.FindElement(By.ClassName("SelAll"));
                IWebElement creaReport = webDriver.FindElement(By.ClassName("Rep"));

                selezionaTicket.Click();
                Timer.Wait(5);
                creaReport.Click();
                Timer.Wait(5);

                if (webDriver.WindowHandles.Count > 1)
                    webDriver.SwitchTo().Window(webDriver.WindowHandles.Last());
                else
                    throw new Exception("Finestra navigazione report non trovata");

                IWebElement techeReportRow = webDriver.FindElement(By.XPath("//span[text()='Teche Report']"));
                new Actions(webDriver)
                    .MoveToElement(techeReportRow)
                    .DoubleClick()
                    .Build()
                    .Perform();

                Timer.Wait(5);
                if (webDriver.WindowHandles.Count > 2)
                    webDriver.SwitchTo().Window(webDriver.WindowHandles.Last());
                else
                    throw new Exception("Finestra report non trovata");

                currentState = State.ReportReady;

                ReadOnlyCollection<IWebElement> elem = webDriver.FindElements(By.TagName("tr"));
                Timer.Wait(5);

                var tickets =
                    elem
                    .Select(row => row.FindElements(By.TagName("td")))
                    .Where(cells => cells.Count > 0)
                    .Select(cells => new
                    {
                        Ticket = cells[0].Text,
                        Stato = cells[1].Text,
                        DataFineAtt = cells[4].Text,
                        Componente = cells[10].Text,
                        ApertoDa = cells[12].Text,
                        InCaricoA = cells[13].Text,
                        Servizio = cells[14].Text,
                    })
                    .Select(x => new
                    {
                        ticket = new ReportCollection(
                            Int32.Parse(x.Ticket),
                            x.Stato,
                            String.IsNullOrEmpty((x.DataFineAtt ?? "").Trim()) ? (DateTime?)null : DateTime.Parse(x.DataFineAtt),
                            x.Componente,
                            x.ApertoDa,
                            (x.InCaricoA ?? "").Trim() == String.Empty ? null : mailingList.FindByLoginName(x.InCaricoA),
                            x.Servizio
                        ),
                        IsMAC = String.IsNullOrEmpty((x.DataFineAtt ?? "").Trim()) || x.Servizio == "MAC",
                    });

                var result = (
                    from pair in tickets
                    orderby pair.IsMAC ? 0 : 1 ascending,                       //MAC per primi
                    pair.ticket.dataFineAtt ascending,                          //Prima quelli a scadenza prossima
                    pair.ticket.stato.ToLower().Contains("assegnato") ? 1 : 0   //Non assegnati per primi
                    select pair.ticket)
                    .ToArray();

                _tickets = new ReadOnlyCollection<ReportCollection>(result);
            }
            finally
            {
                if (webDriver != null)
                {
                    //Eseguo il logout per evitare di lasciare aperta la sessione
                    IWebElement logoutButton;
                    switch (currentState)
                    {
                        case State.LoggedIn:
                            webDriver.SwitchTo().Window(webDriver.WindowHandles[0]);
                            logoutButton = webDriver.FindElement(By.CssSelector(".logout.btn.btn3d.tbbtn"));
                            break;

                        case State.ReportReady:
                            webDriver.SwitchTo().Window(webDriver.WindowHandles[1]);
                            logoutButton = webDriver.FindElement(By.CssSelector("[ardbn=\"btnLogout\"]"));
                            break;

                        default:
                            goto LogoutComplete; //A quanto sembra non è possibile fare un semplice return nel finally
                    }

                    new Actions(webDriver)
                        .MoveToElement(logoutButton)
                        .Click()
                        .Build()
                        .Perform();

                    Timer.Wait(4);

                LogoutComplete:
                    webDriver.Dispose();
                }
            }
        }
Пример #24
0
        public void ScrapeAdds(websites web, bool proxyCondtition, string country, string device, string resolution,string agent)
        {
            Stopwatch watch = new Stopwatch();
            watch.Start();
            updateUI(new System.Action(() => grid("Crawler","Starting crawler............",Color.Green)));

            List<advertisement> adList = new List<advertisement>();
            var service = PhantomJSDriverService.CreateDefaultService();
            service.HideCommandPromptWindow = true;
            var driver = new PhantomJSDriver(service);

            updateUI(new System.Action(() =>  grid("Loading","loading website...............", Color.Green)));

            if (proxyCondtition == true)
            {
                List<string> proxy = Proxy();

                Random rand = new Random();
                int index = rand.Next(proxy.Count);
                string selectProxy = proxy[index];
                string _proxy = selectProxy.Split('&')[0];
                string _credentials = selectProxy.Split('&')[1];
                Proxy prox = new Proxy();
                prox.HttpProxy = string.Format(_proxy);
                service.ProxyType = "http";
                service.Proxy = prox.HttpProxy;
            }

            driver.Navigate().GoToUrl(web.website_url);
            try
            {
                //List<string> resolution = ScreenResolution();
                //Random ran = new Random();
                //int index = ran.Next(resolution.Count);
                //string ScrnRes = resolution[index];
                string ScrnRes = resolution;

                int x = int.Parse(ScrnRes.Split('x')[0]);
                int y = int.Parse(ScrnRes.Split('x')[1]);

                driver.Manage().Window.Size = new Size(x, y);

            }
            catch (Exception ex)
            { }
            //  driver.GetScreenshot().SaveAsFile("image2.png", ImageFormat.Png);

            foreach (var networkName in web.website_networks)
            {
                ad_network adN = new ad_network();
                //adN = adN.SearchByName(networkName);

                adN = ANlist.Find(a => a.name.Equals(networkName));
                if (adN != null)
                {
                    updateUI(new System.Action(() => grid("Network","Network Found:"+ adN.name, Color.Green)));
                    string path1 = null;
                    string path2 = null;
                    string path3 = null;
                    string xpaths = adN.xpath;
                    string[] path = xpaths.Split('|');
                    if (path.Length == 3)
                    {
                        path1 = path[0];
                        path2 = path[1];
                        path3 = path[2];
                    }
                    if (path.Length == 2)
                    {
                        path1 = path[0];
                        path2 = path[1];
                        path3 = "";
                    }

                    NetworkFunctions nf = new NetworkFunctions(this);

                    if (adN.name == "Mgid")
                    {
                        updateUI(new System.Action(() => grid("Scraping:", "Migid Ads", Color.Green)));
                        nf.Mgid(web.website_url, driver, path1, path2, path3, adN, agent);

                    }
                    if (adN.name == "Adblade")
                    {
                        updateUI(new System.Action(() => grid("Scraping:", "Adblade Ads", Color.Green)));
                        nf.Adblade(web.website_url, driver, path1, path2, path3, adN, agent);

                    }
                    if (adN.name == "Gravity")
                    {
                        updateUI(new System.Action(() => grid("Scraping:", "Gravity Ads", Color.Green)));
                        nf.Gravity(web.website_url, driver, path1, path2, path3, adN, agent);
                    }
                    if (adN.name == "Taboola")
                    {
                        updateUI(new System.Action(() => grid("Scraping:", "Taboola Ads", Color.Green)));
                        nf.Taboola(web.website_url, driver, path1, path2, path3, adN, agent);
                    }
                    if (adN.name == "Outbrain")
                    {
                        updateUI(new System.Action(() => grid("Scraping:", "Outbrain Ads", Color.Green)));
                        nf.Outbrain(web.website_url, driver, path1, path2, path3, adN, agent);
                    }
                    if (adN.name == "Zergnet")
                    {
                        updateUI(new System.Action(() => grid("Scraping:", "Zergnet Ads", Color.Green)));
                        nf.ZergNetDotcom(web.website_url, driver, path1, path2, path3, adN, agent);
                    }
                    if (adN.name == "YahooGemini")
                    {
                        updateUI(new System.Action(() => grid("Scraping:", "YahooGemini Ads", Color.Green)));
                        nf.YahooGemini(web.website_url, driver, path1, path2, path3, adN, agent);
                    }
                    if (adN.name == "Hexagram")
                    {
                        updateUI(new System.Action(() => grid("Scraping:", "Hexagram Ads", Color.Green)));
                        nf.Hexagram(web.website_url, driver, path1, path2, path3, adN, agent);
                    }

                    if (adN.name == "Contentad" || adN.name == "Content.ad")
                    {
                        updateUI(new System.Action(() => grid("Scraping:", "Content.ad Ads", Color.Green)));
                        nf.ContentDotAd(web.website_url, driver, path1, path2, path3, adN, agent);
                    }
                    //if (adN.name == "Mgid")
                    //{
                    //    ls = nf.Mgid(driver, path1, path2, path3);
                    //}

                }
            }
            watch.Stop();
            List<websites> list = new List<websites>();
            list = web.SelectAll();
            string ScrapingTime = watch.Elapsed.ToString();
               foreach (var v in list)
            {
                if (v.website_url == web.website_url)
                {
                    web.Update(v._id, ScrapingTime);
                }
            }
            updateUI(new System.Action(() => grid("Time:", web.website_url+":" + ScrapingTime, Color.Green)));
            driver.Quit();
            driver.Dispose();
        }