Provides a way to access PhantomJS to run your tests by creating a PhantomJSDriver instance
When the WebDriver object has been instantiated the browser will load. The test can then navigate to the URL under test and start your test.
Inheritance: OpenQA.Selenium.Remote.RemoteWebDriver, ITakesScreenshot
        public void Before()
        {
            phantomJsDriver = PhantomJsHelper.GetConfiguredPhantomJsDriver(5);

            saoLookupPage = new SaoLookupPage(phantomJsDriver);
            saoIndexResultsPage = new SaoIndexResultsPage(phantomJsDriver);
        }
Example #2
0
        /// <summary>
        /// Creates a driver if it has not been created yet. 
        /// </summary>
        public void SetupDriver()
        {
            if (_driver == null)
            {
                switch (DriverType)
                {
                    case DriverTypes.Phantom:
                        _driver = new PhantomJSDriver(DriversPath);
                        break;
                    case DriverTypes.Firefox:
                        _driver = new FirefoxDriver();
                        break;
                    case DriverTypes.InternetExplorer:
                        var options = new InternetExplorerOptions();
                        options.IgnoreZoomLevel = true;
                        _driver = new InternetExplorerDriver(DriversPath, options);

                        break;
                    case DriverTypes.Chrome:
                    default:
                        if (!File.Exists("chromedriver.exe"))
                        {
                            _driver = new ChromeDriver(DriversPath);
                        }
                        else
                            _driver = new ChromeDriver();
                        break;
                }
            }

        }
Example #3
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();
        }
		/// <summary>
		/// Get a RemoteWebDriver
		/// </summary>
		/// <param name="browser">the Browser to test on</param>
		/// <param name="languageCode">The language that the browser should accept.</param>
		/// <returns>a IWebDriver</returns>
		IWebDriver IWebDriverFactory.GetWebDriver(Browser browser, string languageCode)
		{
			//What browser to test on?s
			IWebDriver webDriver;
			switch (browser.Browserstring.ToLowerInvariant())
			{
				case "firefox":
					var firefoxProfile = new FirefoxProfile();
					firefoxProfile.SetPreference("intl.accept_languages", languageCode);
					webDriver = new FirefoxDriver(firefoxProfile);
					break;
				case "chrome":
					ChromeOptions chromeOptions = new ChromeOptions();
					chromeOptions.AddArguments("--test-type", "--disable-hang-monitor", "--new-window", "--no-sandbox", "--lang=" + languageCode);
					webDriver = new ChromeDriver(chromeOptions);
					break;
				case "internet explorer":
					webDriver = new InternetExplorerDriver(new InternetExplorerOptions { BrowserCommandLineArguments = "singleWindow=true", IntroduceInstabilityByIgnoringProtectedModeSettings = true, EnsureCleanSession = true, EnablePersistentHover = false });
					break;
				case "phantomjs":
					webDriver = new PhantomJSDriver(new PhantomJSOptions() {});
					break;
				default:
					throw new NotSupportedException("Not supported browser");
			}

			return webDriver;
		}
Example #5
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;
        }
        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();
        }
Example #7
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;
        }
Example #8
0
 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;
 }
Example #9
0
 private Jenkins()
 {
     var options = new PhantomJSOptions();
     options.AddAdditionalCapability("phantomjs.page.customHeaders.Accept-Language", "en");
     _driver = new PhantomJSDriver(options);
     _wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(10));
 }
Example #10
0
        private static IWebDriver CreatePhantomJsDriver()
        {
            var driverService = PhantomJSDriverService.CreateDefaultService();
            driverService.HideCommandPromptWindow = true;
            var driver = new PhantomJSDriver(driverService);

            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);
 }
Example #12
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();
        }
Example #13
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();
 }
Example #14
0
 private Jenkins()
 {
     var options = new PhantomJSOptions();
     options.AddAdditionalCapability("phantomjs.page.customHeaders.Accept-Language", "en");
     _driver = new PhantomJSDriver(options);
     _wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(10));
     var jenkinsUrl = Environment.GetEnvironmentVariable("JENKINS_URL");
     Url = string.IsNullOrEmpty(jenkinsUrl) ? "http://localhost:8080" : jenkinsUrl;
 }
        public TaskOrchestrator(string subjectPrefix)
        {
            // Normalize subject prefix to title case, before doing anything else.
            this.subjectPrefix = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(subjectPrefix.ToLower());

            this.phantomJsDriver = PhantomJsHelper.GetConfiguredPhantomJsDriver(25);
            this.phantomJsHelper = new PhantomJsHelper(phantomJsDriver);
            this.saoLookupPage = new SaoLookupPage(phantomJsDriver);
            this.saoIndexResultsPage = new SaoIndexResultsPage(phantomJsDriver);
        }
Example #16
0
        public PhantomJsFactory()
        {
            var option = new OSP.PhantomJSOptions();

            //var preferences = new KeyValuePair<string, object>("chrome.contentSettings.images", "block");

            //option.AddAdditionalCapability("chrome.prefs", preferences);

            _driver = new OSP.PhantomJSDriver(GetPhantomJSDriverService(), option);
        }
Example #17
0
 public Browser()
 {
     Proxy proxy = new Proxy();
     proxy.SslProxy = string.Format("127.0.0.1:9998");
     proxy.HttpProxy = string.Format("127.0.0.1:9999");
     var service = PhantomJSDriverService.CreateDefaultService();
     service.ProxyType = "http";
     service.Proxy = proxy.HttpProxy;
     driver = new PhantomJSDriver(service);
 }
        /// <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;
        }
        static void ConfigureContainer()
        {
            container = new WindsorContainer();

            container.Register(AllTypes.FromThisAssembly().BasedOn<IPageModel>().WithServiceFirstInterface());

            // TODO: vlad - refactor the way phantom being run
            IWebDriver driver = new PhantomJSDriver();
            container.Register(Component.For<IWebDriver>().Instance(driver));

            container.Install(Configuration.FromAppConfig());
        }
 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);
            }
        }
Example #22
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;
        }
        public void ShouldBeAbleToReadArgumentsInScriptExecutedInPhantomJSContext()
        {
            if (!(driver is PhantomJSDriver))
            {
                // Skip this test if not using PhantomJS.
                // The command under test is only available when using PhantomJS
                return;
            }

            PhantomJSDriver phantom = (PhantomJSDriver)driver;

            // Can we read arguments?
            object result = phantom.ExecutePhantomJS("return arguments[0] + arguments[0]", 1L);

            Assert.AreEqual(2L, (long)result);
        }
        public void ShouldBeAbleToReturnResultsFromScriptExecutedInPhantomJSContext()
        {
            if (!(driver is PhantomJSDriver))
            {
                // Skip this test if not using PhantomJS.
                // The command under test is only available when using PhantomJS
                return;
            }

            PhantomJSDriver phantom = (PhantomJSDriver)driver;

            // Do we get results back?
            object result = phantom.ExecutePhantomJS("return 1 + 1");

            Assert.AreEqual(2L, (long)result);
        }
Example #25
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);
        }
 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();
 }
Example #27
0
        /// <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);
                        }
                    }
                }
        }
Example #28
0
        public InParser(string id, string proxy_host, string proxy_port, QueryType queryType)
        {
            Id        = id;
            ProxyHost = proxy_host;
            ProxyPort = proxy_port;
            QueryType = queryType;

            Data = String.Format("{0}/{1}", ProxyHost, ProxyPort);

#pragma warning disable CS0618 // Type or member is obsolete

            PhantomJSDriverService service = PhantomJSDriverService.CreateDefaultService(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));

            PhantomJSOptions options = null;

            if (ProxyHost != "0.0.0.0" && ProxyPort != "0")
            {
                OpenQA.Selenium.Proxy proxy = new OpenQA.Selenium.Proxy();
                proxy.HttpProxy = String.Format(ProxyHost + ":" + ProxyPort);
                proxy.Kind      = ProxyKind.Manual;

                service.ProxyType = "http";
                service.Proxy     = proxy.HttpProxy;

                options = new PhantomJSOptions {
                    Proxy = proxy
                };
            }

            service.HideCommandPromptWindow = true;
            service.IgnoreSslErrors         = true;
            service.SslProtocol             = "any";
            service.WebSecurity             = false;
            service.LocalToRemoteUrlAccess  = true;
            service.LoadImages = false;

            if (options == null)
            {
                Browser = new OpenQA.Selenium.PhantomJS.PhantomJSDriver(service);
            }
            else
            {
                Browser = new OpenQA.Selenium.PhantomJS.PhantomJSDriver(service, options);
            }
        }
        public static IBankDriver CreateDriver(bool debug)
        {
            IWebDriver driver;
            if (debug)
            {
                driver =
                    new ChromeDriver(
                        ChromeDriverService.CreateDefaultService(AppDomain.CurrentDomain.BaseDirectory +
                                                                 "/binaries"));
            }
            else
            {
                driver = new PhantomJSDriver(
                    PhantomJSDriverService.CreateDefaultService(AppDomain.CurrentDomain.BaseDirectory +
                                                                "/binaries"));
            }

            return new BankDriver(new USAA(driver));
        }
Example #30
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);
            }
        }
Example #31
0
        private static IWebDriver CreatePhantomJsDriver(CrawlConfiguration p_Config)
        {
            // Optional options passed to the PhantomJS process.
            PhantomJSOptions options = new PhantomJSOptions();
            options.AddAdditionalCapability("phantomjs.page.settings.userAgent", p_Config.UserAgentString);
            options.AddAdditionalCapability("phantomjs.page.settings.javascriptCanCloseWindows", false);
            options.AddAdditionalCapability("phantomjs.page.settings.javascriptCanOpenWindows", false);
            options.AddAdditionalCapability("acceptSslCerts", !p_Config.IsSslCertificateValidationEnabled);

            // Basic auth credentials.
            options.AddAdditionalCapability("phantomjs.page.settings.userName", p_Config.LoginUser);
            options.AddAdditionalCapability("phantomjs.page.settings.password", p_Config.LoginPassword);

            // Create the service while hiding the prompt window.
            PhantomJSDriverService service = PhantomJSDriverService.CreateDefaultService();
            service.HideCommandPromptWindow = true;
            IWebDriver driver = new PhantomJSDriver(service, options);

            return driver;
        }
        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;
        }
Example #33
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;
        }
Example #34
0
        private QA.IWebDriver InitWebDriver()
        {
            QA.IWebDriver theDriver = null;
            switch (this.browser)
            {
            case Browsers.IE:
            {
                InternetExplorerDriverService driverService = InternetExplorerDriverService.CreateDefaultService(Application.StartupPath + "\\drivers\\");
                driverService.HideCommandPromptWindow = true;
                driverService.SuppressInitialDiagnosticInformation = true;
                ds = driverService;
                QA.IE.InternetExplorerOptions _ieOptions = new QA.IE.InternetExplorerOptions();
                _ieOptions.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
                theDriver = new QA.IE.InternetExplorerDriver(driverService, _ieOptions);
                ProcessID = driverService.ProcessId;
            }; break;

            case Browsers.PhantomJS:
            {
                PhantomJSDriverService driverService = PhantomJSDriverService.CreateDefaultService(Application.StartupPath + "\\Drivers\\");
                driverService.HideCommandPromptWindow = true;
                driverService.SuppressInitialDiagnosticInformation = true;
                ds = driverService;

                theDriver = new QA.PhantomJS.PhantomJSDriver(driverService);
            }; break;

            case Browsers.Chrome:
            {
                ChromeDriverService driverService = ChromeDriverService.CreateDefaultService(Application.StartupPath + "\\drivers\\");
                driverService.HideCommandPromptWindow = true;
                driverService.SuppressInitialDiagnosticInformation = true;
                ds = driverService;

                ChromeOptions options = new QA.Chrome.ChromeOptions();
                options.AddUserProfilePreference("profile.managed_default_content_settings.images", _IsLoadPicture ? 1 : 2);
                options.AddUserProfilePreference("profile.managed_default_content_settings.javascript", _IsLoadJS ? 1 : 2);

                //options.AddArgument(@"--user-data-dir=" + cache_dir);
                //string dir = string.Format(@"user-data-dir={0}", ConfigManager.GetInstance().UserDataDir);
                //options.AddArguments(dir);

                //options.AddArgument("--no-sandbox");
                //options.AddArgument("--disable-dev-shm-usage");
                //options.AddArguments("--disable-extensions"); // to disable extension
                //options.AddArguments("--disable-notifications"); // to disable notification
                //options.AddArguments("--disable-application-cache"); // to disable cache
                try
                {
                    if (_timeout == 60)
                    {
                        theDriver = new QA.Chrome.ChromeDriver(driverService, options, new TimeSpan(0, 0, 40));
                    }
                    else
                    {
                        theDriver = new QA.Chrome.ChromeDriver(driverService, options, new TimeSpan(0, 0, _timeout));
                    }
                }
                catch (Exception ex)
                {
                }
                ProcessID = driverService.ProcessId;
            }; break;

            case Browsers.Firefox:
            {
                var driverService = FirefoxDriverService.CreateDefaultService(Application.StartupPath + "\\drivers\\");
                driverService.HideCommandPromptWindow = true;
                driverService.SuppressInitialDiagnosticInformation = true;
                ds = driverService;

                FirefoxProfile profile = new FirefoxProfile();
                try
                {
                    if (_doproxy == "1")
                    {
                        string proxy = "";
                        try
                        {
                            if (_IsUseNewProxy == false)
                            {
                                proxy = GetProxyA();
                            }
                            else
                            {
                                //TO DO 获取芝麻代理
                                hi.URL = "http:......?你的代理地址";        // ConfigManager.GetInstance().ProxyUrl;
                                hr     = hh.GetContent(hi);
                                if (hr.StatusCode == System.Net.HttpStatusCode.OK)
                                {
                                    if (hr.Content.Contains("您的套餐余量为0"))
                                    {
                                        proxy = "";
                                    }
                                    if (hr.Content.Contains("success") == false)
                                    {
                                        proxy = "";
                                    }

                                    JObject j = JObject.Parse(hr.Content);
                                    foreach (var item in j)
                                    {
                                        foreach (var itemA in item.Value)
                                        {
                                            if (itemA.ToString().Contains("expire_time"))
                                            {
                                                if (DateTime.Now.AddHours(2) < DateTime.Parse(itemA["expire_time"].ToString()))
                                                {
                                                    proxy = itemA["ip"].ToString() + ":" + itemA["port"].ToString();
                                                    break;
                                                }
                                            }
                                        }
                                        if (proxy != "")
                                        {
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                        }

                        if (proxy != "" && proxy.Contains(":"))
                        {
                            OpenQA.Selenium.Proxy proxyF = new OpenQA.Selenium.Proxy();
                            proxyF.HttpProxy = proxy;
                            proxyF.FtpProxy  = proxy;
                            proxyF.SslProxy  = proxy;
                            profile.SetProxyPreferences(proxyF);
                            // 使用代理
                            profile.SetPreference("network.proxy.type", 1);
                            //ProxyUser-通行证书 ProxyPass-通行密钥
                            profile.SetPreference("username", "你的账号");
                            profile.SetPreference("password", "你的密码");

                            // 所有协议公用一种代理配置,如果单独配置,这项设置为false
                            profile.SetPreference("network.proxy.share_proxy_settings", true);

                            // 对于localhost的不用代理,这里必须要配置,否则无法和webdriver通讯
                            profile.SetPreference("network.proxy.no_proxies_on", "localhost");
                        }
                    }
                }
                catch (Exception ex)
                {
                }

                //profile.SetPreference("permissions.default.image", 2);
                // 关掉flash
                profile.SetPreference("dom.ipc.plugins.enabled.libflashplayer.so", false);
                FirefoxOptions options = new FirefoxOptions();
                options.Profile = profile;
                theDriver       = new QA.Firefox.FirefoxDriver(driverService, options, TimeSpan.FromMinutes(1));
                ProcessID       = driverService.ProcessId;
            }; break;

            case Browsers.Safari:
            {
                SafariDriverService driverService = SafariDriverService.CreateDefaultService(Application.StartupPath + "\\Drivers\\");
                driverService.HideCommandPromptWindow = true;
                driverService.SuppressInitialDiagnosticInformation = true;
                ds        = driverService;
                theDriver = new QA.Safari.SafariDriver(driverService);
                ProcessID = driverService.ProcessId;
            }; break;

            default:
            {
                QA.IE.InternetExplorerOptions _ieOptions = new QA.IE.InternetExplorerOptions();
                _ieOptions.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
                theDriver = new QA.IE.InternetExplorerDriver(_ieOptions);
            }; break;
            }
            return(theDriver);
        }
        public PhantomJSDriver(PhantomJSDriverService service, PhantomJSOptions options, TimeSpan commandTimeout) : base(new DriverServiceCommandExecutor(service, commandTimeout, false), PhantomJSDriver.ConvertOptionsToCapabilities(options))
        {
            CommandInfo commandInfo = new CommandInfo("POST", "/session/{sessionId}/phantom/execute");

            base.CommandExecutor.CommandInfoRepository.TryAddCommand("executePhantomScript", commandInfo);
        }
Example #36
0
 /// <summary>
 /// Initializes a new instance of the PhantomJSWebElement class.
 /// </summary>
 /// <param name="parent">Driver in use.</param>
 /// <param name="id">ID of the element.</param>
 internal PhantomJSWebElement(PhantomJSDriver parent, string id)
     : base(parent, id)
 {
 }
Example #37
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PhantomJSWebElement"/> class.
 /// </summary>
 /// <param name="parent">Driver in use.</param>
 /// <param name="id">ID of the element.</param>
 public PhantomJSWebElement(PhantomJSDriver parent, string id)
     : base(parent, id)
 {
 }
Example #38
0
        public VKParser(string id, string proxy_host, string proxy_port, string vk_login, string vk_password, QueryType queryType)
        {
            Id          = id;
            ProxyHost   = proxy_host;
            ProxyPort   = proxy_port;
            VK_Login    = vk_login;
            VK_Password = vk_password;
            QueryType   = queryType;

            Data = String.Format("{0}/{1}/{2}/{3}", ProxyHost, ProxyPort, VK_Login, VK_Password);

#pragma warning disable CS0618 // Type or member is obsolete

            PhantomJSDriverService service = PhantomJSDriverService.CreateDefaultService(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));

            PhantomJSOptions options = null;

            if (ProxyHost != "0.0.0.0" && ProxyPort != "0")
            {
                OpenQA.Selenium.Proxy proxy = new OpenQA.Selenium.Proxy();
                proxy.HttpProxy = String.Format(ProxyHost + ":" + ProxyPort);
                proxy.Kind      = ProxyKind.Manual;

                service.ProxyType = "http";
                service.Proxy     = proxy.HttpProxy;

                options = new PhantomJSOptions {
                    Proxy = proxy
                };
            }

            service.HideCommandPromptWindow = true;
            service.IgnoreSslErrors         = true;
            service.SslProtocol             = "any";
            service.WebSecurity             = false;
            service.LocalToRemoteUrlAccess  = true;
            service.LoadImages = false;

            if (options == null)
            {
                Browser = new OpenQA.Selenium.PhantomJS.PhantomJSDriver(service);
            }
            else
            {
                Browser = new OpenQA.Selenium.PhantomJS.PhantomJSDriver(service, options);
            }

            // login

            FileHelper.WriteToLog("Login...", Data);

            Browser.Navigate().GoToUrl("https://m.vk.com/");

            WebDriverWait ww          = new WebDriverWait(Browser, TimeSpan.FromSeconds(10));
            IWebElement   SearchInput = ww.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("input[name='email']")));

            SearchInput.SendKeys(VK_Login);
            SearchInput = Browser.FindElement(By.CssSelector("input[name='pass']"));
            SearchInput.SendKeys(VK_Password + OpenQA.Selenium.Keys.Enter);

            FileHelper.WriteToLog("Login complete!", Data);
        }
Example #39
-2
        public StepContext(int bankId)
        {
            using (var db = new Entities())
            {
                // To Do: Init TransactionModel
                //this.TransactionModel = 
                this.BankId = bankId;
                var bank = db.Banks.Where(x => x.Id == bankId).FirstOrDefault();
                if(bank != null)
                {
                    
                    switch (bank.WebBrowser.Name.ToLower())
                    {
                        case "chrome":
                            WebDriver = new ChromeDriver();
                            break;
                        case "phantomjs":
                            PhantomJSOptions options = new PhantomJSOptions();
                            if (!string.IsNullOrWhiteSpace(bank.UserAgent))
                            {
                                //"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36"
                                options.AddAdditionalCapability("phantomjs.page.settings.userAgent", bank.UserAgent);
                            }
                            PhantomJSDriverService defaultService = PhantomJSDriverService.CreateDefaultService();
                            defaultService.HideCommandPromptWindow = true;
                            defaultService.LoadImages = false;
                            WebDriver = new PhantomJSDriver(defaultService, options);
                            break;
                        default:
                            WebDriver = new ChromeDriver();
                            break;
                    }
                    
                    WaitDriver = new WebDriverWait(WebDriver, new TimeSpan(0, 0, bank.TimeOut.Value));
                    ShortWaitDriver = new WebDriverWait(WebDriver, new TimeSpan(0, 0, bank.TimeOut.Value / 2));

                    httpClient = new HttpClient() { Timeout = new TimeSpan(0, 0, bank.TimeOut.Value) };
                    TransactionModel = new BankTransaction();
                }
            }
        }