protected IWebDriver CreatePhantomJSDriver() { var service = PhantomJSDriverService.CreateDefaultService(AssemblyDirectory, "phantomjs.exe"); var driver = new PhantomJSDriver(service); driver.Manage().Timeouts().ImplicitlyWait(new TimeSpan(0, 0, 30)); return driver; }
/// <summary> /// Create an instance that implements <see cref="IInformationalWebDriver"/> /// </summary> /// <returns></returns> public IInformationalWebDriver Create() { var driver = new PhantomJSDriver(); //default size driver.Manage().Window.Size = new Size(1280, 800); //there options should come from the environment return new InformationalDriver(Browsers.Phantomjs, null,driver); }
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="Content-Type" content="text/html; charset=utf-8"></meta><style id="DS3Style" type="text/css">@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="fix"><table id="area2Container" width="100%" border="0" cellpadding="0" cellspacing="0" align="center" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color:#f9f9f9"><tr><td width="100%" valign="top" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none;"><table width="600" class="device-width header-logo" border="0" cellpadding="0" cellspacing="0" align="center" bgcolor="#f9f9f9" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none;"><tr><td valign="top" style="border-collapse: collapse !important; border-spacing: 0 !important; padding: 0; border: none;"><p style="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;" align="left">New message: Hi Kobo,As a buyer, I am interest...</p></td></tr></table></td></tr></table> <table id="area3Container" width="100%" border="0" cellpadding="0" cellspacing="0" align="center" style="border-collapse:collapse !important;border-spacing:0 !important;border:none;background-color:#f9f9f9;"><tr><td width="100%" valign="top" style="border-collapse:collapse !important;border-spacing:0 !important;border:none;"><table width="100%" height="7" border="0" cellpadding="0" cellspacing="0" align="center" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-image: url('http://p.ebaystatic.com/aw/navbar/preHeaderBottomShadow.png'); background-repeat: repeat-y no-repeat; margin: 0; padding: 0"><!--[if gte mso 9]><v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" style="mso-width-percent:1000;height:1px;"><v:fill type="tile" color="#dddddd" /></v:rect><v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" style="mso-width-percent:1000;height:6px;"><v:fill type="tile" src="http://p.ebaystatic.com/aw/navbar/preHeaderBottomShadow.png" color="#f9f9f9" /><div style="width:0px; height:0px; overflow:hidden; display:none; visibility:hidden; mso-hide:all;"><![endif]--><tr><td width="100%" height="1" valign="top" align="center" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color: #dddddd; font-size: 1px; line-height: 1px;"><!--[if gte mso 15]>&nbsp;<![endif]--></td></tr><tr><td width="100%" height="6" valign="top" align="center" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color: none; font-size: 1px; line-height: 1px;">&nbsp;</td></tr><!--[if gte mso 9]></div></v:rect><![endif]--></table></td></tr></table> <table id="area4Container" width="100%" border="0" cellpadding="0" cellspacing="0" align="center" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color:#f9f9f9"><tr><td width="100%" valign="top" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none;"><table width="600" class="device-width header-logo" border="0" cellpadding="0" cellspacing="0" align="center" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none;"><tr><td valign="top" style="border-collapse: collapse !important; border-spacing: 0 !important; padding: 15px 0 20px; border: none;"><a href="http://rover.ebay.com/rover/0/e12050.m1831.l3127/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&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" style="text-decoration: none; color: #0654ba;"><img src="http://p.ebaystatic.com/aw/logos/header_ebay_logo_132x46.gif" width="132" height="46" border="0" alt="eBay" align="left" style="display: inline block; outline: none; text-decoration: none; -ms-interpolation-mode: bicubic; border: none;" /></a><img src="http://rover.ebay.com/roveropen/0/e12050/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd" alt="" style="border:0; height:1;"/></td></tr></table></td></tr></table> <table id="area5Container" width="100%" border="0" cellpadding="0" cellspacing="0" align="center" style="border-collapse: collapse !important; border-spacing: 0 !important; background-color:#f9f9f9"> <tr> <td width="100%" valign="top" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none;"> <table id="PrimaryMessage" width="600" class="device-width" border="0" cellpadding="0" cellspacing="0" align="center" bgcolor="#f9f9f9" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none;"> <tr><td valign="top" class="secondary-headline" style="border-collapse: collapse !important; border-spacing: 0 !important; padding: 20px 0 5px;"><h1 style="font-family: Helvetica, Arial, sans-serif; font-weight: normal; line-height: 15px; color: #808284; text-align: left; font-size: 13px; margin: 0 0 4px;" align="left">New message from:<a href="http://rover.ebay.com/rover/0/e12050.m44.l1181/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&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" style="text-decoration: none; font-weight: bold; color: #336fb7;">andfen6</a><a href="http://rover.ebay.com/rover/0/e12050.m44.l1183/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&loc=http%3A%2F%2Ffeedback.ebay.ca%2Fws%2FeBayISAPI.dll%3FViewFeedback%26userid%3Dandfen6%26ssPageName%3DSTRK%3AME%3AUFS" style="text-decoration: none; color: #888888;">(5)</a></h1></td></tr> <tr><td valign="top" class="viewing-problem-block" style="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;"> <table width="600" class="device-width" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none; border:0; cellpadding:0; cellspacing:0; align:center; bgcolor:#f9f9f9;"> <tr><td width="100%" class="wrapText device-width" valign="top" style="overflow: hidden; border-collapse: collapse !important; border-spacing: 0 !important; border: none; display: inline-block; max-width:600px;"><h3 style="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;" align="left"><div id="UserInputtedText">Hi Kobo,<br /><br />As a buyer, I am interested....<br /><br />this is a test message</div></h3> <span style="color:#666666"></span> </td></tr> <tr><td valign="top" width="15" height="15" style="border-collapse: collapse !important; border-spacing: 20 !important; border: none;"></td></tr> <tr><td valign="top" class="cta-block" style="border-collapse: collapse !important; border-spacing: 0 !important; padding: 5px 0 5px; border: none;"><table align="left" cellpadding="0" cellspacing="0" border="0" class="mobile-full-width" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none;"><tr><td valign="top" class="center cta-button primary-cta-button" align="center" style="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='#0079bc', endColorstr='#00519e',GradientType=0 ); background-image: linear-gradient(to bottom, #0079bc 0%,#00519e 100%); background-color: #0079bc; padding: 10px 17px; border: 1px solid #00519e;" bgcolor="#0079bc"><a href="http://rover.ebay.com/rover/0/e12050.m44.l1139/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&loc=http%3A%2F%2Fcontact.ebay.ca%2Fws%2FeBayISAPI.dll%3FM2MContact%26requested%3Dandfen6%26qid%3D1291497258010%26redirect%3D0" style="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;"><span style="padding: 0px 10px">Reply</span></a></td></tr></table> </td></tr> </table></td></tr></table> <!--[if !mso]><!--><div id="V4PrimaryMessage" style="max-height: 0px; font-size: 0; overflow:hidden; display: none !important;"><div><table border="0" cellpadding="2" cellspacing="3" width="100%"><tr><td><font style="font-size:10pt; font-family:arial, sans-serif; color:#000"><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="font-weight:bold; font-size:10pt; font-family:arial, sans-serif; color:#000">- andfen6</div></td><td valign="top" width="185"><div></div></td></tr></table></div></div><!--<![endif]--> </td> </tr></table> <table id="area3Container" width="100%" border="0" cellpadding="0" cellspacing="0" align="center" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color:#f9f9f9"> <tr> <td width="100%" valign="top" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none;"><table width="100%" height="7" border="0" cellpadding="0" cellspacing="0" align="center" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-image: url(&#39;http://p.ebaystatic.com/aw/navbar/preHeaderBottomShadow.png&#39;); background-repeat: repeat-y no-repeat; margin: 0; padding: 0"> <tr><td width="100%" height="1" valign="top" align="center" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color: #dddddd;"></td></tr> <tr><td width="100%" height="6" valign="top" align="center" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color: none;"></td></tr></table> </td> </tr> </table> <table id="area7Container" width="100%" border="0" cellpadding="0" cellspacing="0" align="center" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color:#f9f9f9;"> <tr> <td width="100%" valign="top" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none;"> <table width="600" class="device-width" border="0" cellpadding="0" cellspacing="0" align="center" bgcolor="#f9f9f9" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none;"> <tr><td valign="top" align="center" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none; padding-right:20px;"><h1 style="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;" align="left">Get to know <a href="http://rover.ebay.com/rover/0/e12050.m3965.l1181/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&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" style="text-decoration: none; color: #336fb7;">andfen6</a> </h1><table style="font-family: Helvetica, Arial, sans-serif; font-weight: normal; line-height: 19px; text-align: left; font-size: 14px; margin-bottom: 10px; padding-bottom: 10px;" align="left"><tr><td valign="top" style="font-size: 20px; padding-left: 15px; padding-right: 5px;">&bull;</td><td style="padding-bottom: 5px">Located: Toronto, ON, Canada</td></tr><tr><td valign="top" style="font-size: 20px; padding-left: 15px; padding-right: 5px;">&bull;</td><td style="padding-bottom: 5px">Member since: Dec 17, 2015</td></tr><tr><td valign="top" style="font-size: 20px; padding-left: 15px; padding-right: 5px;">&bull;</td><td style="padding-bottom: 5px">Positive Feedback: 100%</td></tr></table></td></tr></table></td></tr></table> <table id="area10Container" class="whiteSection" width="100%" border="0" cellpadding="0" cellspacing="0" align="center" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color: #ffffff"> <tr> <td width="100%" valign="top" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none;"> <table width="600" class="device-width" border="0" cellpadding="0" cellspacing="0" align="center" bgcolor="#ffffff" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none;"><tr><td valign="top" class="viewing-problem-block" style="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;"><p style="font-family: Helvetica, Arial, sans-serif; font-weight: normal; line-height: normal; color: #888888; text-align: left; font-size: 11px; margin: 0 0 10px;" align="center">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="area11Container" class="whiteSection" width="100%" border="0" cellpadding="0" cellspacing="0" align="center" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color: #ffffff"><tr><td width="100%" valign="top" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none;"> <table width="600" class="device-width" border="0" cellpadding="0" cellspacing="0" align="center" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none;"><tr><td valign="top" class="ebay-footer-block" style="border-collapse: collapse !important; border-spacing: 0 !important; padding: 40px 0 60px; border: none;"> <div id="ReferenceId"><p style="font-family: Helvetica, Arial, sans-serif; font-weight: normal; line-height: normal; color: #888888; text-align: left; font-size: 11px; margin: 0 0 10px;" align="left"><strong>Email reference id: [#a05-c1pifaockd#]_[#68fe0bd048d04a84b6d8ef4046dde4cd#]</strong></p></div><p style="font-family: Helvetica, Arial, sans-serif; font-weight: normal; line-height: normal; color: #888888; text-align: left; font-size: 11px; margin: 0 0 10px;" align="left">We don't check this mailbox, so please don't reply to this message. If you have a question, go to <a style="text-decoration: none; color: #555555;" href="http://rover.ebay.com/rover/0/e12050.m1852.l6369/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&loc=http%3A%2F%2Focsnext.ebay.ca%2Focs%2Fhome" target="_blank">Help & Contact</a>.</p> <p style="font-family: Helvetica, Arial, sans-serif; font-weight: normal; line-height: normal; color: #888888; text-align: left; font-size: 11px; margin: 0 0 10px;" align="left">eBay sent this message to Nantha Gopalasamy (rakutenkobo). Learn more about <a style="text-decoration: none; color: #555555;" href="http://rover.ebay.com/rover/0/e12050.m1852.l3167/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&loc=http%3A%2F%2Fpages.ebay.ca%2Fhelp%2Faccount%2Fprotecting-account.html" target="_blank">account protection</a>. eBay is committed to your privacy. Learn more about our <a style="text-decoration: none; color: #555555;" href="http://rover.ebay.com/rover/0/e12050.m1852.l3168/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&loc=http%3A%2F%2Fpages.ebay.ca%2Fhelp%2Fpolicies%2Fprivacy-policy.html" target="_blank">privacy policy</a> and <a style="text-decoration: none; color: #555555;" href="http://rover.ebay.com/rover/0/e12050.m1852.l3165/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&loc=http%3A%2F%2Fpages.ebay.ca%2Fhelp%2Fpolicies%2Fuser-agreement.html" target="_blank">user agreement</a>.</p><p style="font-family: Helvetica, Arial, sans-serif; font-weight: normal; line-height: normal; color: #888888; text-align: left; font-size: 11px; margin: 0 0 10px;" align="left">&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="Content-Type" content="text/html; charset=utf-8"></meta><style id="DS3Style" type="text/css">@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="fix"><table id="area2Container" width="100%" border="0" cellpadding="0" cellspacing="0" align="center" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color:#f9f9f9"><tr><td width="100%" valign="top" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none;"><table width="600" class="device-width header-logo" border="0" cellpadding="0" cellspacing="0" align="center" bgcolor="#f9f9f9" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none;"><tr><td valign="top" style="border-collapse: collapse !important; border-spacing: 0 !important; padding: 0; border: none;"><p style="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;" align="left">New message: Hi Kobo,As a buyer, I am interest...</p></td></tr></table></td></tr></table> <table id="area3Container" width="100%" border="0" cellpadding="0" cellspacing="0" align="center" style="border-collapse:collapse !important;border-spacing:0 !important;border:none;background-color:#f9f9f9;"><tr><td width="100%" valign="top" style="border-collapse:collapse !important;border-spacing:0 !important;border:none;"><table width="100%" height="7" border="0" cellpadding="0" cellspacing="0" align="center" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-image: url('http://p.ebaystatic.com/aw/navbar/preHeaderBottomShadow.png'); background-repeat: repeat-y no-repeat; margin: 0; padding: 0"><!--[if gte mso 9]><v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" style="mso-width-percent:1000;height:1px;"><v:fill type="tile" color="#dddddd" /></v:rect><v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" style="mso-width-percent:1000;height:6px;"><v:fill type="tile" src="http://p.ebaystatic.com/aw/navbar/preHeaderBottomShadow.png" color="#f9f9f9" /><div style="width:0px; height:0px; overflow:hidden; display:none; visibility:hidden; mso-hide:all;"><![endif]--><tr><td width="100%" height="1" valign="top" align="center" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color: #dddddd; font-size: 1px; line-height: 1px;"><!--[if gte mso 15]>&nbsp;<![endif]--></td></tr><tr><td width="100%" height="6" valign="top" align="center" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color: none; font-size: 1px; line-height: 1px;">&nbsp;</td></tr><!--[if gte mso 9]></div></v:rect><![endif]--></table></td></tr></table> <table id="area4Container" width="100%" border="0" cellpadding="0" cellspacing="0" align="center" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color:#f9f9f9"><tr><td width="100%" valign="top" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none;"><table width="600" class="device-width header-logo" border="0" cellpadding="0" cellspacing="0" align="center" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none;"><tr><td valign="top" style="border-collapse: collapse !important; border-spacing: 0 !important; padding: 15px 0 20px; border: none;"><a href="http://rover.ebay.com/rover/0/e12050.m1831.l3127/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&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" style="text-decoration: none; color: #0654ba;"><img src="http://p.ebaystatic.com/aw/logos/header_ebay_logo_132x46.gif" width="132" height="46" border="0" alt="eBay" align="left" style="display: inline block; outline: none; text-decoration: none; -ms-interpolation-mode: bicubic; border: none;" /></a><img src="http://rover.ebay.com/roveropen/0/e12050/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd" alt="" style="border:0; height:1;"/></td></tr></table></td></tr></table> <table id="area5Container" width="100%" border="0" cellpadding="0" cellspacing="0" align="center" style="border-collapse: collapse !important; border-spacing: 0 !important; background-color:#f9f9f9"> <tr> <td width="100%" valign="top" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none;"> <table id="PrimaryMessage" width="600" class="device-width" border="0" cellpadding="0" cellspacing="0" align="center" bgcolor="#f9f9f9" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none;"> <tr><td valign="top" class="secondary-headline" style="border-collapse: collapse !important; border-spacing: 0 !important; padding: 20px 0 5px;"><h1 style="font-family: Helvetica, Arial, sans-serif; font-weight: normal; line-height: 15px; color: #808284; text-align: left; font-size: 13px; margin: 0 0 4px;" align="left">New message from:<a href="http://rover.ebay.com/rover/0/e12050.m44.l1181/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&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" style="text-decoration: none; font-weight: bold; color: #336fb7;">andfen6</a><a href="http://rover.ebay.com/rover/0/e12050.m44.l1183/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&loc=http%3A%2F%2Ffeedback.ebay.ca%2Fws%2FeBayISAPI.dll%3FViewFeedback%26userid%3Dandfen6%26ssPageName%3DSTRK%3AME%3AUFS" style="text-decoration: none; color: #888888;">(5)</a></h1></td></tr> <tr><td valign="top" class="viewing-problem-block" style="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;"> <table width="600" class="device-width" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none; border:0; cellpadding:0; cellspacing:0; align:center; bgcolor:#f9f9f9;"> <tr><td width="100%" class="wrapText device-width" valign="top" style="overflow: hidden; border-collapse: collapse !important; border-spacing: 0 !important; border: none; display: inline-block; max-width:600px;"><h3 style="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;" align="left"><div id="UserInputtedText">Hi Kobo,<br /><br />As a buyer, I am interested....<br /><br />this is a test message</div></h3> <span style="color:#666666"></span> </td></tr> <tr><td valign="top" width="15" height="15" style="border-collapse: collapse !important; border-spacing: 20 !important; border: none;"></td></tr> <tr><td valign="top" class="cta-block" style="border-collapse: collapse !important; border-spacing: 0 !important; padding: 5px 0 5px; border: none;"><table align="left" cellpadding="0" cellspacing="0" border="0" class="mobile-full-width" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none;"><tr><td valign="top" class="center cta-button primary-cta-button" align="center" style="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='#0079bc', endColorstr='#00519e',GradientType=0 ); background-image: linear-gradient(to bottom, #0079bc 0%,#00519e 100%); background-color: #0079bc; padding: 10px 17px; border: 1px solid #00519e;" bgcolor="#0079bc"><a href="http://rover.ebay.com/rover/0/e12050.m44.l1139/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&loc=http%3A%2F%2Fcontact.ebay.ca%2Fws%2FeBayISAPI.dll%3FM2MContact%26requested%3Dandfen6%26qid%3D1291497258010%26redirect%3D0" style="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;"><span style="padding: 0px 10px">Reply</span></a></td></tr></table> </td></tr> </table></td></tr></table> <!--[if !mso]><!--><div id="V4PrimaryMessage" style="max-height: 0px; font-size: 0; overflow:hidden; display: none !important;"><div><table border="0" cellpadding="2" cellspacing="3" width="100%"><tr><td><font style="font-size:10pt; font-family:arial, sans-serif; color:#000"><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="font-weight:bold; font-size:10pt; font-family:arial, sans-serif; color:#000">- andfen6</div></td><td valign="top" width="185"><div></div></td></tr></table></div></div><!--<![endif]--> </td> </tr></table> <table id="area3Container" width="100%" border="0" cellpadding="0" cellspacing="0" align="center" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color:#f9f9f9"> <tr> <td width="100%" valign="top" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none;"><table width="100%" height="7" border="0" cellpadding="0" cellspacing="0" align="center" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-image: url(&#39;http://p.ebaystatic.com/aw/navbar/preHeaderBottomShadow.png&#39;); background-repeat: repeat-y no-repeat; margin: 0; padding: 0"> <tr><td width="100%" height="1" valign="top" align="center" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color: #dddddd;"></td></tr> <tr><td width="100%" height="6" valign="top" align="center" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color: none;"></td></tr></table> </td> </tr> </table> <table id="area7Container" width="100%" border="0" cellpadding="0" cellspacing="0" align="center" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color:#f9f9f9;"> <tr> <td width="100%" valign="top" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none;"> <table width="600" class="device-width" border="0" cellpadding="0" cellspacing="0" align="center" bgcolor="#f9f9f9" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none;"> <tr><td valign="top" align="center" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none; padding-right:20px;"><h1 style="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;" align="left">Get to know <a href="http://rover.ebay.com/rover/0/e12050.m3965.l1181/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&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" style="text-decoration: none; color: #336fb7;">andfen6</a> </h1><table style="font-family: Helvetica, Arial, sans-serif; font-weight: normal; line-height: 19px; text-align: left; font-size: 14px; margin-bottom: 10px; padding-bottom: 10px;" align="left"><tr><td valign="top" style="font-size: 20px; padding-left: 15px; padding-right: 5px;">&bull;</td><td style="padding-bottom: 5px">Located: Toronto, ON, Canada</td></tr><tr><td valign="top" style="font-size: 20px; padding-left: 15px; padding-right: 5px;">&bull;</td><td style="padding-bottom: 5px">Member since: Dec 17, 2015</td></tr><tr><td valign="top" style="font-size: 20px; padding-left: 15px; padding-right: 5px;">&bull;</td><td style="padding-bottom: 5px">Positive Feedback: 100%</td></tr></table></td></tr></table></td></tr></table> <table id="area10Container" class="whiteSection" width="100%" border="0" cellpadding="0" cellspacing="0" align="center" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color: #ffffff"> <tr> <td width="100%" valign="top" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none;"> <table width="600" class="device-width" border="0" cellpadding="0" cellspacing="0" align="center" bgcolor="#ffffff" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none;"><tr><td valign="top" class="viewing-problem-block" style="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;"><p style="font-family: Helvetica, Arial, sans-serif; font-weight: normal; line-height: normal; color: #888888; text-align: left; font-size: 11px; margin: 0 0 10px;" align="center">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="area11Container" class="whiteSection" width="100%" border="0" cellpadding="0" cellspacing="0" align="center" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none; background-color: #ffffff"><tr><td width="100%" valign="top" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none;"> <table width="600" class="device-width" border="0" cellpadding="0" cellspacing="0" align="center" style="border-collapse: collapse !important; border-spacing: 0 !important; border: none;"><tr><td valign="top" class="ebay-footer-block" style="border-collapse: collapse !important; border-spacing: 0 !important; padding: 40px 0 60px; border: none;"> <div id="ReferenceId"><p style="font-family: Helvetica, Arial, sans-serif; font-weight: normal; line-height: normal; color: #888888; text-align: left; font-size: 11px; margin: 0 0 10px;" align="left"><strong>Email reference id: [#a05-c1pifaockd#]_[#68fe0bd048d04a84b6d8ef4046dde4cd#]</strong></p></div><p style="font-family: Helvetica, Arial, sans-serif; font-weight: normal; line-height: normal; color: #888888; text-align: left; font-size: 11px; margin: 0 0 10px;" align="left">We don't check this mailbox, so please don't reply to this message. If you have a question, go to <a style="text-decoration: none; color: #555555;" href="http://rover.ebay.com/rover/0/e12050.m1852.l6369/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&loc=http%3A%2F%2Focsnext.ebay.ca%2Focs%2Fhome" target="_blank">Help & Contact</a>.</p> <p style="font-family: Helvetica, Arial, sans-serif; font-weight: normal; line-height: normal; color: #888888; text-align: left; font-size: 11px; margin: 0 0 10px;" align="left">eBay sent this message to Nantha Gopalasamy (rakutenkobo). Learn more about <a style="text-decoration: none; color: #555555;" href="http://rover.ebay.com/rover/0/e12050.m1852.l3167/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&loc=http%3A%2F%2Fpages.ebay.ca%2Fhelp%2Faccount%2Fprotecting-account.html" target="_blank">account protection</a>. eBay is committed to your privacy. Learn more about our <a style="text-decoration: none; color: #555555;" href="http://rover.ebay.com/rover/0/e12050.m1852.l3168/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&loc=http%3A%2F%2Fpages.ebay.ca%2Fhelp%2Fpolicies%2Fprivacy-policy.html" target="_blank">privacy policy</a> and <a style="text-decoration: none; color: #555555;" href="http://rover.ebay.com/rover/0/e12050.m1852.l3165/7?euid=68fe0bd048d04a84b6d8ef4046dde4cd&loc=http%3A%2F%2Fpages.ebay.ca%2Fhelp%2Fpolicies%2Fuser-agreement.html" target="_blank">user agreement</a>.</p><p style="font-family: Helvetica, Arial, sans-serif; font-weight: normal; line-height: normal; color: #888888; text-align: left; font-size: 11px; margin: 0 0 10px;" align="left">&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(); }
/// <summary> /// Sets up a customized instance of PhantomJS with regards to log level, command window visibility and timeouts. /// </summary> /// <returns>The PhantomJSDriver instance with customized configuration.</returns> public static PhantomJSDriver GetConfiguredPhantomJsDriver(int timeoutInSeconds) { PhantomJSDriverService phantomJsDriverService = PhantomJSDriverService.CreateDefaultService(); phantomJsDriverService.HideCommandPromptWindow = true; PhantomJSOptions options = new PhantomJSOptions(); options.AddAdditionalCapability("phantomjs.cli.args", new String[] { "--webdriver-loglevel=ERROR" }); PhantomJSDriver phantomJsDriver = new PhantomJSDriver(phantomJsDriverService, options); phantomJsDriver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(timeoutInSeconds)); return phantomJsDriver; }
/// <summary> /// Path is assuming that Phantomjs executable is in project folder (root) of tests. /// Path is from the root to the file or folder. /// </summary> /// <param name="path">Path to file (htm, html) or folder to files (htm, html)</param> /// <returns></returns> public static IEnumerable<TestCaseData> GetTestResults(string path) { if (string.IsNullOrEmpty(path)) throw new NullReferenceException("parameter file cant be null or empty!"); bool isPathDirectory; var combinedPath = Path.Combine(Environment.CurrentDirectory, path); if (!PathIsValid(combinedPath, out isPathDirectory)) { if (!isPathDirectory) throw new Exception("File not exepted, only, htm or html files are ok"); throw new Exception("Directory contains no valid files"); } using (var phantomJs = new PhantomJSDriver(Environment.CurrentDirectory)) { phantomJs.Manage().Timeouts().ImplicitlyWait(new TimeSpan(0, 0, 0, 10)); if (isPathDirectory) { var qUnitTests = new List<NPQTest>(); foreach (var file in Directory.GetFiles(Path.Combine(Environment.CurrentDirectory, path), "*.htm").Select(file => file.Replace(Environment.CurrentDirectory + "\\", "")).ToList()) { var tests = phantomJs.GetTests(file); qUnitTests.AddRange(tests); } foreach (var qUnitTest in qUnitTests) { yield return MapTestCaseData(qUnitTest); } } else { foreach (var qTest in phantomJs.GetTests(path)) { yield return MapTestCaseData(qTest); } } } }
/// <summary> /// 使用 JS 引擎请求页面 /// </summary> /// <param name="url"></param> /// <param name="cookieContainer"></param> /// <returns></returns> public string QueryRequest(string url, CookieContainer cookieContainer = null) { var domain = Regex.Matches(url, "(?i)(https*?://)*(.+?)/")[0].Result("$2"); var index = domain.IndexOf(".", StringComparison.Ordinal); if (index != domain.LastIndexOf(".", StringComparison.Ordinal)) { domain = domain.Substring(index); } cookieContainer.GetAllCookies().ForEach(f => { _driver.Manage().Cookies.AddCookie(new OS.Cookie(f.Name, f.Value, domain, "/", DateTime.Now.AddDays(1))); }); _driver.Url = url; return(_driver.FindElementByTagName("body").Text); }
public static IWebDriver CreateWebDriver() { var proxyHost = AppSettingsHelper.ReadString(AppSettings.Proxy); var proxyPort = AppSettingsHelper.ReadInt(AppSettings.ProxyPort); var proxyString = $"{proxyHost}:{proxyPort}"; var proxy = new Proxy { HttpProxy = proxyString, FtpProxy = proxyString, SslProxy = proxyString }; var phantomJsOptions = new PhantomJSOptions(); phantomJsOptions.AddAdditionalCapability(CapabilityType.Proxy, proxy); var driver = new PhantomJSDriver(phantomJsOptions); driver.Manage().Timeouts().ImplicitlyWait(new TimeSpan(0, 0, 30)); return driver; }
public void Init() { var pjs = new PhantomJSDriver(); pjs.Manage().Window.Size = this.windowSize; this.driver = pjs; }
public static IWebDriver CreatePhantomDriver() { PhantomJSDriverService service = PhantomJSDriverService.CreateDefaultService(); //service.IgnoreSslErrors = true; //service.LoadImages = false; //service.ProxyType = "none"; //service.SslProtocol = "tlsv1"; //"any" "tlsv1" PhantomJSOptions opts = new PhantomJSOptions(); opts.AddAdditionalCapability("phantomjs.page.settings.userAgent", "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.65 Safari/537.36"); var PhantomDriver = new PhantomJSDriver(service, opts); PhantomDriver.Manage().Timeouts().SetPageLoadTimeout(new TimeSpan(0, 1, 0)); PhantomDriver.Manage().Timeouts().ImplicitlyWait(new TimeSpan(0, 0, 1)); return PhantomDriver; }
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(); }