Example #1
0
 public void SetupTest()
 {
     HttpCommandProcessor processor = new HttpCommandProcessor();
     DefaultBrowserLauncher launcher = new InternetExplorerBrowserLauncher();
     selenium = new DefaultSelenium(processor, launcher, DefaultSelenium.SELENESE_RUNNER_URL.Replace("html", "hta"));
     selenium.Start();
 }
Example #2
0
 public void SetupTest()
 {
     url = "http://localhost:52994/";
     selenium = new DefaultSelenium("localhost", 4444, "*chrome", url);
     selenium.Start();
     verificationErrors = new StringBuilder();
 }
Example #3
0
 public void SetupTest()
 {
     url      = "http://localhost:52994/";
     selenium = new DefaultSelenium("localhost", 4444, "*chrome", url);
     selenium.Start();
     verificationErrors = new StringBuilder();
 }
 public void SetupTest()
 {
     HttpCommandProcessor processor = new HttpCommandProcessor();
     DefaultBrowserLauncher launcher = new DefaultBrowserLauncher();
     selenium = new DefaultSelenium(processor, launcher);
     selenium.Start();
 }
 public void SetupTest()
 {
     //selenium = new DefaultSelenium("localhost", 4444, "*chrome", "https://maps.google.com/");
     selenium = new DefaultSelenium("localhost", 5555, "*iexplore", "https://maps.google.com/");
     selenium.Start();
     verificationErrors = new StringBuilder();
 }
 public void MyTestInitialize()
 {
     selenium = new DefaultSelenium("localhost", 4444, "*chrome", "https://login.live.com/");
     selenium.Start();
     selenium.SetSpeed("800");
     verificationErrors = new StringBuilder();
 }
        /**
         * SetupTest used to create a Selenium object and start it
         *
         */
        private void SetupTest()
        {
            string filename   = "java";
            string parameters = @" -jar selenium-server.jar";

            System.Diagnostics.Process[] allProcess = System.Diagnostics.Process.GetProcessesByName("java");
            try
            {
                if (allProcess.Length == 0)
                {
                    System.Diagnostics.Process.Start(filename, parameters);
                    System.Threading.Thread.Sleep(3000);

                    selenium = new DefaultSelenium("localhost", 4444, "*iexplore", "http://www.set.or.th");
                    selenium.Start();
                    selenium.SetTimeout("100000");
                    selenium.UseXpathLibrary("javascript-xpath");
                }
            }
            catch (System.Exception e)
            {
                logger.LogErrorAndRaiseException("Selenium console not started." + e.ToString());
                System.Windows.Forms.Application.Exit();
            }
        }
Example #8
0
        public void SetupTest(string nav)
        {
            selenium = new DefaultSelenium("localhost", 4444, "*" + nav, "http://localhost:9080");

            selenium.Start();
            verificationErrors = new StringBuilder();
        }
Example #9
0
 public void SetUp()
 {
     selenium = new DefaultSelenium("localhost", 4444, "*iexplore", "http://localhost");
     selenium.Start();
     selenium.Open("http://localhost");
     silvernium = new Silvernium(selenium, "Test");
 }
Example #10
0
        public SimpleWebTest()
        {
            this.verificationErrors = new StringBuilder();
            this.browser            =
                (BrowserType)Enum.Parse(typeof(BrowserType), ConfigurationManager.AppSettings["SELENIUM_BROWSER"], true);
            this.seleniumHost = ConfigurationManager.AppSettings["SELENIUM_HOST"];
            this.seleniumPort = int.Parse(
                ConfigurationManager.AppSettings["SELENIUM_PORT"], CultureInfo.InvariantCulture);
            this.seleniumSpeed = ConfigurationManager.AppSettings["SELENIUM_SPEED"];
            this.seleniumWait  = int.Parse(
                ConfigurationManager.AppSettings["SELENIUM_WAIT"], CultureInfo.InvariantCulture);
            this.browserUrl = ConfigurationManager.AppSettings["SELENIUM_URL"];

            string browserExe;

            switch (this.browser)
            {
            case BrowserType.InternetExplorer:
                browserExe = "*iexplore";
                break;

            case BrowserType.Firefox:
                browserExe = "*firefox";
                break;

            case BrowserType.Chrome:
                browserExe = "*chrome";
                break;

            default:
                throw new NotSupportedException();
            }

            this.selenium = new DefaultSelenium(this.seleniumHost, this.seleniumPort, browserExe, this.browserUrl);
        }
Example #11
0
		public void SetupTest()
		{
			base.StartServer();
			selenium = new DefaultSelenium("localhost", 4444, "*chrome", ConfigurationManager.AppSettings["baseUrl"]);
			selenium.Start();
			verificationErrors = new StringBuilder();
		}
Example #12
0
        // UpdateResourceFile("pradeep","@E:\AdminScripts\ECommerce_CodeBase\PreRequisite_Suite\Resources\Customers.resx");

        /// <summary> To Launch the browser & to login to Open Bet application
        /// </summary>
        ///  Author: Yogesh
        /// Ex: AdminBase.init()
        /// <returns>None</returns>
        /// Created Date: 22-Dec-2011
        /// Modified Date:
        /// Modification Comments:
        public void Init()
        {
            if (FrameGlobals.useGrid.ToUpper() == "YES")
            {
                FirefoxProfile      ffProfile            = new FirefoxProfile();
                DesiredCapabilities desriredCapibilities = null;
                desriredCapibilities = new DesiredCapabilities();
                desriredCapibilities = DesiredCapabilities.Firefox();
                desriredCapibilities.SetCapability(CapabilityType.BrowserName, "firefox");
                // ffProfile.SetPreference("general.useragent.override", FrameGlobals.userAgentValue);

                FfDriver  = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), desriredCapibilities, TimeSpan.FromSeconds(420.0));
                MyBrowser = new WebDriverBackedSelenium(FfDriver, "http://www.google.com"); //_seleniumContainer.Add(Gallio.Framework.TestContext.CurrentContext.Test.Name, MyBrowser);
            }
            else
            {
                FfDriver  = new FirefoxDriver();
                MyBrowser = new WebDriverBackedSelenium(FfDriver, FrameGlobals.OBUrl);
                //MyBrowser = new WebDriverBackedSelenium(FfDriver, "https://stg-gib.ladbrokes.com/admin");
            }
            MyBrowser.Start();
            MyBrowser.Open(FrameGlobals.OBUrl);
            MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
            MyBrowser.Type(AdminSuite.CommonControls.AdminHomePage.UsrNmeTxtBx, FrameGlobals.AdminName);
            MyBrowser.Type(AdminSuite.CommonControls.AdminHomePage.PwdTxtBx, FrameGlobals.AdminPass);
            // MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
            MyBrowser.Click(AdminSuite.CommonControls.AdminHomePage.LoginBtn);
            MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut.ToString());
            // MyBrowser.WindowMaximize();
            FfDriver.Manage().Window.Maximize();
        }
        /// <summary>
        /// Method to update and validate event status validations
        /// </summary>
        public void EventStatusValidation(ISelenium browser, ISelenium adminBrowser,TestData testData, string navPanel)
        {
            string eventStatus, updatedStatus;
            string alternateStatus = "Suspended";

            try
            {
                #region Event Status validation

                eventStatus = GetEventStatus(browser, testData.ClassName, navPanel, testData);
                if (eventStatus == "Suspended")
                    alternateStatus = "Active";
                adminCommonObj.UpdateEvents(adminBrowser, testData.CategoryName, testData.ClassName, testData.TypeName, testData.SubTypeName, testData.EventName, alternateStatus);
                Thread.Sleep(FrameGlobals.OpenBetReflectTimeOut);
                Console.WriteLine("Event status is updated in admin");

                updatedStatus = GetEventStatus(browser, testData.ClassName, navPanel, testData);
                Assert.IsFalse(Equals(eventStatus, updatedStatus), "Event status is not updated on the page");

                #endregion

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                CaptureScreenshot(browser, "EventStatusValidation");
            }
        }
Example #14
0
 public virtual void SetupTest()
 {
     proc = new HttpCommandProcessor("localhost", 4444, "*chrome", _3DR_Testing.Properties.Settings.Default._3DRURL);
     selenium = new DefaultSelenium(proc);
     verificationErrors = new StringBuilder();
     selenium.Start();
 }
Example #15
0
 public void Start()
 {
     this.selenium = new DefaultSelenium("localhost", 4444,
                                         "*firefox", ConfigurationManager.AppSettings["SELENIUM_URL"]);
     this.selenium.Start();
     this.verificationErrors = new StringBuilder();
 }
Example #16
0
 /// <summary>
 /// Click the ASP.NET control element (usually a Button instance) directly and wait for the response
 /// when expectPostBack is true.
 /// </summary>
 /// <param name="control">The ASP.NET control to click on</param>
 /// <param name="expectPostBack">Whether to expect a server request from the click</param>
 /// <param name="samePage">Whether the PostBack stays on the same page with the same HTML element</param>
 /// <param name="expectedStatusCode">Expected StatusCode of the response</param>
 /// <param name="delay">Optional delay time in milliseconds before clicking the element</param>
 /// <param name="pause">Optional pause time in milliseconds after IE claims DocumentComplete</param>
 public static void Click(this ISelenium inst, Control control, bool expectPostBack = true, bool samePage = false,
                          int expectedStatusCode = 200, int delay = 0, int pause = 0)
 {
     SeleniumExtensionBase.ClickID(inst, control.ClientID,
                                   expectRequest: expectPostBack, samePage: samePage,
                                   expectedStatusCode: expectedStatusCode, delay: delay, pause: pause);
 }
Example #17
0
        public void Should_be_able_to_start_multiple_explicit_instances_for_different_sites()
        {
            SeleniumSupport target = CreateTarget(true);

            const string serverHost    = "localhost";
            const int    serverPort    = 4444;
            string       browserString = _firefoxBrowser;

            ISelenium firstInstance = target.CreateInstance(serverHost, serverPort, browserString, "http://www.google.co.uk");

            Assert.IsNotNull(firstInstance);
            Assert.AreEqual(1, target.Instances.Count);

            ISelenium secondInstance = target.CreateInstance(serverHost, serverPort, browserString, "http://www.microsoft.com");

            Assert.IsNotNull(secondInstance);
            Assert.AreEqual(2, target.Instances.Count);
            Assert.AreNotSame(firstInstance, secondInstance);

            // Dispose of class to clear up resources
            target.DisposeInstance(firstInstance);
            target.DisposeInstance(secondInstance);

            target.Dispose();
        }
Example #18
0
        public void Should_be_able_to_dispose_of_an_explicit_instance_without_affecting_standard_instance()
        {
            SeleniumSupport target = CreateTarget(true);

            const string serverHost    = "localhost";
            const int    serverPort    = 4444;
            string       browserString = _firefoxBrowser;

            ISelenium defaultInstance = target.Start(serverHost, serverPort, browserString, "http://www.google.co.uk");

            Assert.IsNotNull(defaultInstance);
            Assert.AreEqual(1, target.Instances.Count);

            ISelenium explicitInstance = target.CreateInstance(serverHost, serverPort, browserString, "http://www.microsoft.com");

            Assert.IsNotNull(explicitInstance);
            Assert.AreEqual(2, target.Instances.Count);
            Assert.AreNotSame(defaultInstance, explicitInstance);
            Assert.AreSame(target.Selenium, defaultInstance);


            target.DisposeInstance(explicitInstance);
            Assert.AreEqual(1, target.Instances.Count);
            Assert.IsNotNull(target.Selenium);

            // Dispose of class to clear up resources
            target.Dispose();
        }
Example #19
0
 public Security(ISelenium selenium)
 {
     this.selenium = selenium;
     Login();
     SwitchToSecurity();
     ClickBanUnban();
 }
Example #20
0
        /// <summary>
        /// Method to get the text from the desired Element/Control
        /// </summary>
        ///Authout : Vamsi Krishna Boyapati
        ///Date : 25th-March-2013
        /// <param name="objMySelenium">Selenium RC instance</param>
        /// <param name="strLocator"> Locator of the Control/Element(Xpath)</param>
        /// <param name="strExpText"> String Expected text</param>
        /// <returns>Boolean value(True/False)</returns>
        public bool ValidatingTextOnControl(ISelenium objMySelenium, string strLocator, string strExpText)
        {
            bool       bStatus        = true;
            string     strTemp        = null;
            IWebDriver objMyWebDriver = ((WebDriverBackedSelenium)objMySelenium).UnderlyingWebDriver;

            try
            {
                if (objMyWebDriver.FindElement(By.XPath(strLocator)).Displayed)
                {
                    strTemp = objMyWebDriver.FindElement(By.XPath(strLocator)).Text;
                    strTemp = strTemp.ToUpper().Trim().Replace(" ", "");
                    if (!(strTemp.Contains(strExpText.ToUpper().Trim().Replace(" ", ""))))
                    {
                        bStatus = false;
                    }
                }
                else
                {
                    bStatus = false;
                }
            }
            catch (AutomationException EX)
            {
                Console.WriteLine(EX.Message);
            }
            return(bStatus);
        }
Example #21
0
        public void SetUp()
        {
            mockProcessor = new DynamicMock(typeof(ISelenium));
            ISelenium selenium = (ISelenium)mockProcessor.MockInstance;

            flashSelenium = new FlashSelenium.FlashSelenium(selenium, flashObjectId);
        }
Example #22
0
        //Start the browser depending on the setting
        public void GetDriver(WebBrowsers webBrws)
        {
            WebBrws = webBrws;
            if (webBrws == WebBrowsers.Ie)
            {
                //Secutiry setting for IE
                var capabilitiesInternet = new InternetExplorerOptions { IntroduceInstabilityByIgnoringProtectedModeSettings = true };
                Driver = new InternetExplorerDriver(capabilitiesInternet);
            }
            else
                if (webBrws == WebBrowsers.FireFox)
                {
                    //FirefoxBinary binary = new FirefoxBinary(@"C:\Program Files (x86)\Mozilla Firefox\firefox.exe");
                    FirefoxProfile profile = new FirefoxProfile();
                    // profile.SetPreference("webdriver.firefox.bin", "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe");
                    Driver = new FirefoxDriver(profile);
                }
                else
                    if (webBrws == WebBrowsers.Chrome)
                    {
                        //Chrome driver requires the ChromeDriver.exe
                        Driver = new ChromeDriver(@"..\..\..\lib\BrowserDriver\Chrome");
                    }
                    else { throw new WebDriverException(); }

            Selenium = new WebDriverBackedSelenium(Driver, BaseUrl);
        }
 public void SetUp()
 {
     selenium = new DefaultSelenium("localhost", 4444, "*iexplore", URL);
     selenium.Start();
     selenium.Open(URL);
     silvernium = new Silvernium(selenium, OBJECTID, SCRIPTKEY);
 }
Example #24
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="disposed"></param>
 protected virtual void Dispose(bool disposed)
 {
     if (!disposed)
     {
         _selenium = null;
     }
 }
Example #25
0
        public void SetupClass()
        {
            base.StartServer();
            selenium = new DefaultSelenium("localhost", 4444, "*chrome", ConfigurationManager.AppSettings["baseUrl"]);
            selenium.Start();
            verificationErrors = new StringBuilder();

            selenium.DeleteAllVisibleCookies();

            selenium.Open("/dna/mbfood/");
            // To Do
            // too general, could crash test if a topic happened to have the wrong name 
            Assert.IsFalse(selenium.IsTextPresent("error"));
            Assert.IsFalse(selenium.IsTextPresent("There has been a problem"));

            selenium.Click("link=Sign in");
            selenium.Click("bbcid_username");
            selenium.Type("bbcid_username", "mpgsuper");
            selenium.Type("bbcid_password", "ratbags");
            selenium.Click("signin");
            selenium.WaitForPageToLoad("30000");

            // going this way so as to be certain to get the right site options without thinking about it
            selenium.Click("link=Site Options");
            selenium.WaitForPageToLoad("30000");

            // check a) where we are b) BBC site requirements for page titles https://confluence.dev.bbc.co.uk/display/DNA/Meta+Data - note that this title breaks those guidelines
            Assert.AreEqual("BBC - Food - DNA Administration - Site Options - Food", selenium.GetTitle());
            Assert.IsTrue(selenium.IsElementPresent("//input[@name='sov_49_General_CustomBarlesquePath']");

            stateOfOption = selenium.GetValue("//input[@name='so_49_General_CustomBarlesquePath' and @type='radio' and @checked='']/@value");
            valueOfOption = selenium.GetValue("//input[@name='so_49_General_CustomBarlesquePath' and @type='text']");
        }
 public void SetUp()
 {
     selenium = new DefaultSelenium("localhost", 4444, "*iexplore", URL);
     selenium.Start();
     selenium.Open(URL);
     silvernium = new Silvernium(selenium, OBJECTID, SCRIPTKEY);
 }
Example #27
0
 public Security(ISelenium selenium)
 {
     this.selenium = selenium;
     Login();
     SwitchToSecurity();
     ClickBanUnban();
 }
        ///<summary>
        /// This method verifies the details on COntact Us page
        /// <example>VerifyContactusPage(MyBrowser)</example>        
        public void VerifyContactusPage(ISelenium browser)
        {
            try
            {
                HGFcommonObj.selectMenuButton(browser);
                HGFcommonObj.clickObject(browser, LoginLogoutControls.loginOrRegisterLink);
                Thread.Sleep(1000);
                Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.lostLoginButton), "Lost Login button is not present in mobile's login page");
                HGFcommonObj.clickObject(browser, LoginLogoutControls.lostLoginButton);

                Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.contactUsBanner), "'Contact us' banner is not present in the Contact Us page");
                Assert.IsTrue(browser.IsTextPresent("To speak to our 24 hour Customer Support team please contact us on:"), "Contact Us message is not present in the Contact Us page");
                Assert.IsTrue(browser.IsTextPresent("Call us on:"), "'Call us on' message is not present in the Contact Us page");

                Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.UKContacts), "UK contact details are not not present in the Contact Us page");
                Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.NonUKContacts), "Non UK contact details are not not present in the Contact Us page");
                Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.emailContacts), "eMail information is not present in the Contact Us page");
                Console.WriteLine("UI Verification of Contact us page via 'Lost Login' was successful");

                HGFcommonObj.SelectLinksFromSideBar(browser, "Contact us", "Contact Us");
                Assert.IsTrue(browser.IsTextPresent("To speak to our 24 hour Customer Support team please contact us on:"), "Contact Us message is not present in the Contact Us page");
                Assert.IsTrue(browser.IsTextPresent("Call us on:"), "'Call us on' message is not present in the Contact Us page");
                Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.UKContacts), "UK contact details are not not present in the Contact Us page");
                Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.NonUKContacts), "Non UK contact details are not not present in the Contact Us page");
                Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.emailContacts), "eMail information is not present in the Contact Us page");
                Console.WriteLine("UI Verification of Contact us page via 'Side Menu' was successful");
            }
            catch (Exception ex)
            {
                Console.WriteLine("Function 'VerifyContactusPage' - Failed");
                Console.WriteLine(ex.Message);
                Fail(ex.Message);
            }
        }
Example #29
0
 virtual public void SetupTest()
 {
     proc               = new HttpCommandProcessor("localhost", 4444, "*chrome", _3DR_Testing.Properties.Settings.Default._3DRURL);
     selenium           = new DefaultSelenium(proc);
     verificationErrors = new StringBuilder();
     selenium.Start();
 }
        public void SetupTest()
        {
            oWA_XMLData.LoadXML("../../Config/ApplicationSetting.xml");

            URL = oWA_XMLData.getNodeValue("settings/URL/Application");

            browserType = oWA_XMLData.getNodeValue("settings/browserdata/browser");

            if (browserType.ToLower().Equals("firefox") || browserType.ToLower().Equals("ff"))
            {
                driver = new FirefoxDriver();
            }
            else if (browserType.ToLower().Equals("internet explorer") || browserType.ToLower().Equals("ie"))
            {
                driver = new InternetExplorerDriver();
            }
            else if (browserType.ToLower().Equals("chrome"))
            {
                driver = new ChromeDriver(getPathToDrivers());
            }
            else if (browserType.Equals(""))
            {
                driver = new FirefoxDriver();
            }
            else
            {
                driver = new FirefoxDriver();
            }

            driver.Manage().Window.Maximize();

            selenium = new WebDriverBackedSelenium(driver, URL);

            driver.Navigate().GoToUrl(URL);
        }
Example #31
0
 ///<summary>
 /// This method selects an object in a collection(button, link)
 /// <example>clickObjectInColl(browser, xPath, elementName)</example>       
 public void clickObjectInColl(ISelenium browserObj, string strLocator, string elementName)
 {
     IWebDriver driver = ((WebDriverBackedSelenium)browserObj).UnderlyingWebDriver;
     try
     {
         Thread.Sleep(1000);
         ReadOnlyCollection<IWebElement> element = driver.FindElements(By.XPath(strLocator));
         for (int i = 0; i < element.Count; i++)
         {
             if (element[i].Text.ToLower().Trim() == elementName.ToLower().Trim())
             {
                 element[i].Click();
                 break;
             }
             else
             {
                 if (i == element.Count - 1)
                 {
                     Fail(elementName + " object was not found");
                 }
             }
         }
         WaitForLoadingIcon(browserObj, Convert.ToInt32(FrameGlobals.IconLoadTimeout + 5000));
     }
     catch (Exception ex)
     {
         Console.WriteLine("Function 'clickObject' - Failed");
         Console.WriteLine(ex.Message);
         Fail(ex.Message);
     }
 }
 //Constructor
 public SeleniumMsTestLiveAccountLogin1()
 {
     selenium = new DefaultSelenium("localhost", 4444, "*chrome", "https://login.live.com/");
     selenium.Start();
     selenium.SetSpeed("800");
     verificationErrors = new StringBuilder();
 }
 public void SetUp()
 {
     selenium = new DefaultSelenium("localhost", 4444, "*iexplore", "http://localhost");
     selenium.Start();
     selenium.Open("http://localhost");
     silvernium = new Silvernium(selenium, "Test");
 }
        public void Init()
        {
            //Deleting cookies in ie browser through command line.
            /*var procStartInfo = new System.Diagnostics.ProcessStartInfo("cmd", "/c RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2");
            var proc = new System.Diagnostics.Process { StartInfo = procStartInfo };
            proc.Start();
            WebDriverObj = new InternetExplorerDriver();
            */
            string URL = "https://stg-gib.ladbrokes.com/admin";
            WebDriverObj = new FirefoxDriver();
            MyBrowser = new WebDriverBackedSelenium(WebDriverObj, URL);
            MyBrowser.Start();
            WebDriverObj.Manage().Window.Maximize();
            MyBrowser.WindowMaximize();

            MyBrowser.Open(URL);
            MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
            MyBrowser.Refresh();
            MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
            MyBrowser.Type(TestDataCreation.ControlsRepository.UsrNmeTxtBx, "Automation1");
            MyBrowser.Type(TestDataCreation.ControlsRepository.PwdTxtBx, "aditi123");
            MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
            MyBrowser.Click(TestDataCreation.ControlsRepository.LoginBtn);
            MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
        }
Example #35
0
        /// <summary>
        /// Method to enter text to Desired editbox
        /// </summary>
        /// Authour: Vamsi krishna Boyapati
        /// Date:25th-March-2013
        /// <param name="objMySelenium">Selenium RC instance</param>
        /// <param name="strLocator">Locator of the Control/Element(Xpath)</param>
        /// <param name="strText"> string text</param>
        /// <returns>Boolean value(True/False)</returns>
        public bool EnterTextToEditBox(ISelenium objMySelenium, string strLocator, string strText)
        {
            bool       bStatus        = true;
            IWebDriver objMyWebDriver = ((WebDriverBackedSelenium)objMySelenium).UnderlyingWebDriver;
            TimeSpan   ts             = new TimeSpan(0, 0, 60);

            objMyWebDriver.Manage().Timeouts().ImplicitlyWait(ts);
            try
            {
                if (objMyWebDriver.FindElement(By.XPath(strLocator)).Displayed)
                {
                    if (objMySelenium.IsEditable(strLocator))
                    {
                        objMyWebDriver.FindElement(By.XPath(strLocator)).Click();
                        Thread.Sleep(2000);
                        objMyWebDriver.FindElement(By.XPath(strLocator)).SendKeys(strText);
                    }
                    else
                    {
                        bStatus = false;
                    }
                }
                else
                {
                    bStatus = false;
                }
            }
            catch (AutomationException EX)
            {
                Console.WriteLine(EX.Message);
            }
            return(bStatus);
        }
Example #36
0
        //Start the browser depending on the setting
        public void GetDriver(WebBrowsers webBrws)
        {
            WebBrws = webBrws;
            if (webBrws == WebBrowsers.Ie)
            {
                //Secutiry setting for IE
                var capabilitiesInternet = new InternetExplorerOptions {
                    IntroduceInstabilityByIgnoringProtectedModeSettings = true
                };
                Driver = new InternetExplorerDriver(capabilitiesInternet);
            }
            else
            if (webBrws == WebBrowsers.FireFox)
            {
                //FirefoxBinary binary = new FirefoxBinary(@"C:\Program Files (x86)\Mozilla Firefox\firefox.exe");
                FirefoxProfile profile = new FirefoxProfile();
                // profile.SetPreference("webdriver.firefox.bin", "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe");
                Driver = new FirefoxDriver(profile);
            }
            else
            if (webBrws == WebBrowsers.Chrome)
            {
                //Chrome driver requires the ChromeDriver.exe
                Driver = new ChromeDriver(@"..\..\..\lib\BrowserDriver\Chrome");
            }
            else
            {
                throw new WebDriverException();
            }

            Selenium = new WebDriverBackedSelenium(Driver, BaseUrl);
        }
Example #37
0
 public void Start()
 {
     this.selenium = new DefaultSelenium("localhost", 4444,
         "*firefox", ConfigurationManager.AppSettings["SELENIUM_URL"]);
     this.selenium.Start();
     this.verificationErrors = new StringBuilder();
 }
Example #38
0
        public void SetupTest()
        {
            selenium = new DefaultSelenium("localhost", 4444, "*chrome", UpgradeSeleniumTester.browserURL);
            selenium.Start();
            verificationErrors = new StringBuilder();

        }
Example #39
0
        public void SetupTest()
        {
            selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://*****:*****@"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Documents and Settings\RolandoV\My Documents\PWAS\PWAS_Site\PWAS_Site\App_Data\PWAS_DB.mdf;Integrated Security=True;User Instance=True");
            orderRepo        = new OrderRepository(@"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Documents and Settings\RolandoV\My Documents\PWAS\PWAS_Site\PWAS_Site\App_Data\PWAS_DB.mdf;Integrated Security=True;User Instance=True");
            orderHistoryRepo = new OrderHistoryRepository(@"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Documents and Settings\RolandoV\My Documents\PWAS\PWAS_Site\PWAS_Site\App_Data\PWAS_DB.mdf;Integrated Security=True;User Instance=True");
            if (orderRepo.Orders.Where(o => o.job_name == "Salsa Impulse").Count() > 0)
            {
                List <Order>        orders     = orderRepo.Orders.Where(o => o.job_name == "Salsa Impulse").ToList();
                List <OrderHistory> ohistories = (from oh in orderHistoryRepo.OrderHistories
                                                  where (from o in orders
                                                         select o.orderID).Contains(oh.orderId)
                                                  select oh).ToList();
                Table <OrderHistory> ohTable = (Table <OrderHistory>)orderHistoryRepo.OrderHistories;
                ohTable.DeleteAllOnSubmit(ohistories);

                Table <Order> orderTable = (Table <Order>)orderRepo.Orders;
                orderTable.DeleteAllOnSubmit(orders);

                ohTable.Context.SubmitChanges();
                orderTable.Context.SubmitChanges();
            }

            if (userRepo.Users.Where(u => u.email == "*****@*****.**").Count() > 0)
            {
                User user = userRepo.Users.First(u => u.email.Trim() == "*****@*****.**");
                userRepo.DeleteUser(user.userID);
                userRepo.SubmitChanges();
            }
            verificationErrors = new StringBuilder();
        }
Example #40
0
        ///<summary>
        /// To exclude a customer from a company
        /// Author: Yogesh
        /// Ex:Customer_CompanyExclusion(myBrowser)
        /// <returns>None</returns>
        /// Created Date: 22-Dec-2011
        /// Modified Date: 22-Dec-2011
        /// Modification Comments:
        public void CustomerCompanyExclusion(ISelenium myBrowser)
        {
            _isUpdateCustomersResourceFile = false;
            string cmpnyExclu = "ATEcommATCmpnyExcl";
            string guidBnCust = Guid.NewGuid().ToString().Substring(0, 3);

            cmpnyExclu = cmpnyExclu + guidBnCust;
            string strUser = _common.CreateCustomer(myBrowser, cmpnyExclu, StrPasswrd);

            if (strUser != "Fail")
            {
                myBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.CompanyExcludedCustomerBtn);
                _frameworkCommon.WaitUntilAllElementsLoad(myBrowser);
                System.Threading.Thread.Sleep(10000);
                Assert.IsTrue(myBrowser.IsTextPresent("New Company Exclusion Added"), "Company Exclusion is unsuccessfull");
                _isUpdateCustomersResourceFile = _common.UpdateCustomerResouceFile("CompanyExcludedCustomer", strUser, StrPasswrd);
                if (_isUpdateCustomersResourceFile == false)
                {
                    Framework.BaseTest.Fail("Customers Resource File updation failed.");
                }
            }
            else
            {
                Framework.BaseTest.Fail("User creation Failed");
            }
        }
Example #41
0
        ///<summary>
        /// To add a customer belonging to a banned country
        /// Author: Yogesh
        /// Ex:Customer_CompanyExclusion(myBrowser)
        /// <returns>None</returns>
        /// Created Date: 22-Dec-2011
        /// Modified Date:
        public void CustomerFrmBannedCntry(ISelenium myBrowser)
        {
            _isUpdateCustomersResourceFile = false;
            string banCustomer = "ATEcommATBnCust";
            string guidBnCust  = Guid.NewGuid().ToString().Substring(0, 4);

            banCustomer = banCustomer + guidBnCust;

            string strUser = _common.CreateCustomer(myBrowser, banCustomer, StrPasswrd);

            if (strUser != "Fail")
            {
                //strUser = common.SelectMainFrame(myBrowser);
                _common.SelectMainFrame(myBrowser);
                Assert.IsTrue(myBrowser.IsElementPresent(AdminSuite.CustomerCreation.CustomersPage.UpdateRegistrationButton), "Update Registration button is not found");
                myBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.UpdateRegistrationButton);

                const string strBannedCountryName = "Italy";
                myBrowser.Select(AdminSuite.CustomerCreation.CustomersPage.CntryTxtBx, strBannedCountryName);
                myBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.UpdateCustomerButton);
                _frameworkCommon.WaitUntilAllElementsLoad(myBrowser);
                Assert.IsTrue(myBrowser.IsTextPresent(strBannedCountryName), "Change of country to a Banned Country is not successfull");
                _isUpdateCustomersResourceFile = _common.UpdateCustomerResouceFile("BannedCountryCustomer", strUser, StrPasswrd);
                if (_isUpdateCustomersResourceFile == false)
                {
                    Framework.BaseTest.Fail("Customers Resource File updation failed.");
                }
            }
            else
            {
                Framework.BaseTest.Fail("User creation Failed");
            }
        }
        public void Start(string siteUrl)
        {
            _siteUrl = siteUrl;

            _selenium = new DefaultSelenium(Configuration.SeleniumHost, Configuration.SeleniumPort, "*firefox", _siteUrl);
            _selenium.Start();
            _selenium.SetTimeout(Timeout);
        }
Example #43
0
        public JavaSelenium(ISelenium pSelenium, string pObjectID)
        {
            _selenium = pSelenium;
            _objectID = pObjectID;

            _selenium.Start();
            _SetJSPrefix();
        }
Example #44
0
 public void ShutdownSelenium()
 {
     if (selenium != null)
     {
         selenium.Stop();
         selenium = null;
     }
 }
Example #45
0
 /// <summary>
 /// Instantiates a new Home Page object. Pass in the Selenium object created in the test SetUp().
 /// When the object in instantiated it will navigate to the root
 /// </summary>
 /// <param name="selenium">Selenium Object created in the tests
 public Home(ISelenium selenium)
 {
     this._selenium = selenium;
     if (!selenium.GetTitle().Contains("home"))
     {
         selenium.Open("/");
     }
 }
Example #46
0
        public void SetUp()
        {
            _mock = new DynamicMock(typeof(ISelenium));

            ISelenium selenium = (ISelenium)_mock.MockInstance;

            _javaSelenium = new JavaSelenium.JavaSelenium(selenium, OBJECT_ID);
        }
Example #47
0
        public JavaSelenium(ISelenium pSelenium, string pObjectID)
        {
            _selenium = pSelenium;
            _objectID = pObjectID;

            _selenium.Start();
            _SetJSPrefix();
        }
Example #48
0
        public void shouldReturnJSPrefixForFirefox3()
        {
            mockProcessor.ExpectAndReturn("GetEval", Firefox3UserAgentInfo, new object[] { "navigator.userAgent" });
            ISelenium selenium = (ISelenium)mockProcessor.MockInstance;
            FlashSeleniumExtensionForTest flashSelenium = new FlashSeleniumExtensionForTest(selenium, "test");

            Assert.AreEqual("window.document['test'].", flashSelenium.checkBrowserAndReturnJSPrefix());
        }
Example #49
0
        public void StartSelenium()
        {
            string platform = System.Configuration.ConfigurationManager.AppSettings["Platform"];
            selenium = new DefaultSelenium("localhost", 4444, platform, "http://www.google.com.hk/");

            selenium.Start();
            selenium.WindowMaximize();
        }
 public void ShouldTestFlashSeleniumInOpera()
 {
     selenium = GetSelenium("*opera");
     flashSelenium = new FlashSelenium.FlashSelenium(selenium, flashObjectId);
     flashSelenium.Start();
     flashSelenium.Open(URL);
     flashSelenium.Call("click");
     Assert.AreEqual("BLUE", flashSelenium.Call("getColor"));
 }
 public void MyTestCleanup()
 {
     if (selenium != null)
     {
         selenium.Close();
         selenium.Stop();
     }
     selenium = null;
 }
Example #52
0
 /// <summary>
 /// Instantiates a new Home Page object. Pass in the Selenium object created in the test SetUp(). 
 /// When the object in instantiated it will navigate to the root
 /// </summary>
 /// Selenium Object created in the tests
 public Home(ISelenium selenium)
 {
     this._selenium = selenium;
     if (!selenium.GetTitle().Contains("home"))
     {
         selenium.Open("/");
     }
     selenium.WindowMaximize();
 }
        public void Initialize()
        {
            RemoteWebDriver driver = new OpenQA.Selenium.Firefox.FirefoxDriver();

            selenium = new WebDriverBackedSelenium(driver, "http://localhost/SiteStarter");

            selenium.Start();
            verificationErrors = new StringBuilder();
        }
Example #54
0
 public Silvernium(ISelenium selenium, string silverlightObjectId, string scriptKey)
 {
     if (!string.IsNullOrEmpty(scriptKey))
     {
         this.scriptKey = scriptKey + ".";
     }
     this.selenium = selenium;
     silverLightJSStringPrefix = GetSilverLightJSStringPrefix(silverlightObjectId);
 }
Example #55
0
        /// <summary>
        /// Launches the Selenium RC and browser specified in the Environments.cs file
        /// </summary>
        public ISelenium LaunchBrowser(ISelenium browser)
        {
            browser = new DefaultSelenium(this.environment.host, this.environment.port, this.environment.browser, this.environment.baseURL);
            browser.Start();
            browser.SetTimeout(this.environment.timeout);
            browser.WindowMaximize();
            browser.WindowFocus();

            return browser;
        }
Example #56
0
        public ISelenium GetCurrentSelenium()
        {
            if (selenium == null)
            {
                selenium = new WebDriverBackedSelenium(StartDriver(), "http://localhost:" + this.port.ToString() + "/selenium-server/tests");
                selenium.Start();
            }

            return selenium;
        }