예제 #1
0
        public void TestNameFieldEmpty()
        {
            var         chromeDriver = new BrowserUtility().Init(driver);
            IWebElement nameField    = chromeDriver.FindElement(By.CssSelector("#Name"));

            nameField.SendKeys("");
            IWebElement emailField = chromeDriver.FindElement(By.CssSelector("#Email"));

            emailField.SendKeys("*****@*****.**");
            IWebElement userNameField = chromeDriver.FindElement(By.CssSelector("#Username"));

            userNameField.SendKeys("Random");
            IWebElement passwordField = chromeDriver.FindElement(By.CssSelector("#Password"));

            passwordField.SendKeys("Random");
            IWebElement telephoneField = chromeDriver.FindElement(By.CssSelector("#Telephone"));

            telephoneField.SendKeys("1111111");
            IWebElement element = chromeDriver.FindElement(By.CssSelector(".ui.fluid.large.primary.submit.button"));

            element.Click();
            var errorMessage = chromeDriver.FindElement(By.CssSelector(".list > li:nth-child(1)")).Text;


            Assert.AreEqual("The Name field is required.", errorMessage);

            chromeDriver.Close();
        }
예제 #2
0
        public void Method3()
        {
            var Driver = new BrowserUtility().Init(driver);

            driver.FindElement(By.Id("comment")).SendKeys("good \n morning");
            Driver.Close();
        }
        public void TestMethod2()
        {
            var driver = new BrowserUtility().Init(Driver);

            IWebElement email = driver.FindElement(By.XPath("//input[@id='email']"));

            email.SendKeys("Password");
            IWebElement password = driver.FindElement(By.XPath("//input[@id='pass']"));

            password.SendKeys("Password");
            IWebElement   year_drp      = driver.FindElement(By.XPath("//select[@id='year']"));
            IWebElement   month_drp     = driver.FindElement(By.XPath("//select[@id='month']"));
            IWebElement   day_drp       = driver.FindElement(By.XPath("//select[@id='day']"));
            SelectElement element_day   = new SelectElement(day_drp);
            SelectElement element_month = new SelectElement(month_drp);
            SelectElement element_year  = new SelectElement(year_drp);

            element_day.SelectByValue("22");
            Thread.Sleep(200);
            element_month.SelectByIndex(3);
            Thread.Sleep(200);
            element_year.SelectByText("2020");
            Thread.Sleep(2000);

            driver.Close();
        }
예제 #4
0
        public void TestMethod4()

        {
            var Driver = new BrowserUtility().Init(driver);

            Driver.FindElement(By.Id("txtusername")).SendKeys("30442293");
        }
        public void JSFunction()
        {
            //NOte >>-----> [s]string and [S]String are same coz they both are same type <<<<--System.String-->>> Method==> .GetType().FullName

            var Driver = new BrowserUtility().InitChrome(driver);

            Driver.Url = "http://demo.automationtesting.in/Register.html";
            IJavaScriptExecutor js = ((IJavaScriptExecutor)Driver);

            //SetText Using JavaScript function
            String      aFor      = "david";
            IWebElement firstName = Driver.FindElement(By.XPath("//input[@placeholder='First Name']"));

            js.ExecuteScript("arguments[0].value='" + aFor + "';", firstName);
            Thread.Sleep(2000);

            //GetText Using JavaScript function
            IWebElement headerTest = Driver.FindElement(By.XPath("//h1[contains(text(),'Automation Demo Site')]"));

            Console.WriteLine(js.ExecuteScript("return (arguments[0].innerHTML).toString();", headerTest));

            Thread.Sleep(2000);

            //Click Using JavaScript function
            IWebElement forgetPasswordLink = Driver.FindElement(By.XPath("//input[@id='checkbox1']"));

            js.ExecuteScript("arguments[0].click();", forgetPasswordLink);

            js.ExecuteScript("window.scrollBy(0, 1000)");
            Thread.Sleep(1500);
            js.ExecuteScript("window.scrollBy(0, -1000)");
        }
예제 #6
0
파일: page.cs 프로젝트: tralivali1234/IL2JS
        public Ribbon()
        {
            InitializeComponent();
            BrowserUtility.InitBrowserUtility();

            // Register the test page component with command info
            _testComponent = new TestPageComponent();
            PageManager.Instance.AddPageComponent(_testComponent);

            _ribbon = new JSObject();
            _ribbon.SetField <bool>("initStarted", false);
            _ribbon.SetField <bool>("buildMinimized", true);
            _ribbon.SetField <bool>("launchedByKeyboard", false);
            _ribbon.SetField <bool>("initialTabSelectedByUser", false);
            _ribbon.SetField <string>("initialTabId", "Ribbon.Read");

            Anchor readTabA     = (Anchor)Browser.Document.GetById(ReadTabId).FirstChild;
            Anchor libraryTabA  = (Anchor)Browser.Document.GetById(LibraryTabId).FirstChild;
            Anchor documentTabA = (Anchor)Browser.Document.GetById(DocumentTabId).FirstChild;

            readTabA.Click     += RibbonStartInit;
            libraryTabA.Click  += RibbonStartInit;
            documentTabA.Click += RibbonStartInit;

            Browser.Window.Resize += HandleWindowResize;
        }
예제 #7
0
        public BrowserWrapperControl(GetHiddenDriver getHiddenDriver, string processName)
        {
            var window = IntPtr.Zero;

            void SetWindow(IntPtr value)
            {
                window = value;
            }

            IntPtr GetWindow()
            {
                return(window);
            }

            if (!ContainerPanel.IsHandleCreated)
            {
                ContainerPanel.CreateControl();
            }
            var invoke = getHiddenDriver?.Invoke(out DriverService, ContainerPanel.Handle,
                                                 SetWindow);

            WebDriver = invoke?.Item2;
            //var windows = WebDriver?.WindowHandles.Select(e => long.Parse(e)).ToArray();
            Thread = invoke?.Item1;
            var processById = BrowserUtility.GetBrowserProcess(GetWindow, processName);

            Process            = processById;
            KillProcessOnClose = false;
            Loaded            += Window_Loaded;
        }
예제 #8
0
 void OnProjectChange()
 {
     if (BrowserUtility.guiEnabled)
     {
         BrowserUtility.ForceUpdate();
         Repaint();
     }
 }
예제 #9
0
        public void Start()
        {
            BrowserUtility.Init();
            extent = new ExtentReports();
            var htmlReporter = new ExtentHtmlReporter(@"C:\Users\Damilola\source\repos\TestAutomationFramework\Extent_Reports\Report.html");

            extent.AttachReporter(htmlReporter);
        }
예제 #10
0
        public void TestMethod9()
        {
            var         Driver         = new BrowserUtility().Init(driver);
            IWebElement EmailTextField = driver.FindElement(By.XPath("//*[@id='email']"));

            EmailTextField.SendKeys("Selenium c#");
            Driver.Close();
        }
예제 #11
0
        public void ChromeBrowser08()
        {
            var         Driver         = new BrowserUtility().Init(driver);
            IWebElement emailTextField = Driver.FindElement(By.XPath(".//*[@id='email']"));

            emailTextField.SendKeys("*****@*****.**");
            Driver.Close();
        }
예제 #12
0
        public void TestMethod7()
        {
            var         Driver   = new BrowserUtility().Init(driver);
            IWebElement userName = Driver.FindElement(By.XPath(".//*[@name='fullname']"));

            userName.SendKeys("da da da");
            Driver.Close(); // בהורשה כזאת חייב לסגור את הפונקציה אחרת זה רץ ברקע
        }
예제 #13
0
        public void TestLogin5()
        {
            var         Driver       = new BrowserUtility().Init(driver);
            IWebElement usernamePlem = Driver.FindElement(By.Id("user"));

            usernamePlem.SendKeys("Mateusz");
            Driver.Close();
        }
예제 #14
0
        public void TestPassword4()
        {
            var         Driver = new BrowserUtility().Init(driver);
            IWebElement pwPlem = Driver.FindElement(By.Id("password"));

            pwPlem.SendKeys("Mateusz");
            Driver.Close();
        }
        public void TestMethod8()
        {
            var         Driver         = new BrowserUtility().Init(driver);
            IWebElement emailTextField = Driver.FindElement(By.XPath(".//*[@id='gh-ac']"));

            emailTextField.SendKeys("Selenium C#");
            Driver.Close();
        }
예제 #16
0
        public void TestMethodParallel7()
        {
            var         Driver         = new BrowserUtility().initFirefox(driver);
            IWebElement emailTextField = Driver.FindElement(By.XPath("//input[@id='email']"));

            emailTextField.SendKeys("*****@*****.**");
            Thread.Sleep(2000);
            Driver.Close();
        }
예제 #17
0
 void DisplaySwitchBranchPopup(int index)
 {
     if (EditorUtility.DisplayDialog(
             "Confirm Branch Checkout/Clean",
             "This will CLEAN the project. Any uncommited changes will be irretrievably lost! Are you sure you want to continue?", "Ok", "Cancel"))
     {
         BrowserUtility.localBranchIndex = index;
         BrowserUtility.OnButton_CheckoutBranch(this);
     }
 }
예제 #18
0
        public void TestMethod3()
        {
            var Driver = new BrowserUtility().init(driver);

            Driver.Url = "https://www.digitalife.com.mx/";
            HomePage home = new HomePage(Driver);

            home.SearchBox.SendKeys("Ryzen 5");
            Thread.Sleep(3000);
            Driver.Close();
        }
예제 #19
0
 public void OnProcessStop(int errorCode, string stdout, string stderr)
 {
     BrowserUtility.guiEnabled = true;
     Repaint();
     if (errorCode == 0)
     {
         BrowserUtility.stagedFiles.Clear();
         BrowserUtility.workingTree.Clear();
     }
     BrowserUtility.ForceUpdate();
     AssetDatabase.Refresh();
 }
예제 #20
0
        public void Test7()
        {
            var Driver = new BrowserUtility().Init(driver);


            IWebElement emailFeilds = Driver.FindElement(By.XPath(".//*[@id='email']"));

            emailFeilds.SendKeys("*****@*****.**");
            IWebElement password = driver.FindElement(By.XPath(".//*[@id='password']"));

            password.SendKeys("Ec1505451@");
            Driver.Close();
        }
예제 #21
0
        internal void OnLoadCompleteInternal()
        {
            // Only auto-select or auto-run on the first request
            if (!_aspNetService.GetIsPostBack(this))
            {
                // Get query string values
                QueryStringParameters queryParams = new QueryStringParameters();
                queryParams.LoadFromQueryString(_aspNetService.GetQueryString(this));

                BrowserVersions browser = BrowserUtility.GetBrowser(_aspNetService.GetBrowserName(this), _aspNetService.GetBrowserMajorVersion(this));

                LogDetail = queryParams.LogDetail;
                this.WriteLogToDiskCheckBox.Checked = queryParams.WriteLog;
                this.ShowConsoleCheckBox.Checked    = queryParams.ShowConsole;

                // Auto-select tests with a given tag
                if (!String.IsNullOrEmpty(queryParams.Tag))
                {
                    _testcaseManager.SelectTaggedTests(this.TestCasesTreeView, queryParams.Tag, browser);
                }
                else if (queryParams.Run)
                {
                    _testcaseManager.SelectAllTests(this.TestCasesTreeView, browser);
                }

                // Optionally remove unselected tests
                if (queryParams.Filter)
                {
                    _testcaseManager.FilterIgnoredTests(this.TestCasesTreeView);
                }

                // Auto-run the selected tests (or all tests if none are selected)
                if (queryParams.Run)
                {
                    RunTestCases();
                }
            }

            // Change UI depending if showing console or not.
            if (this.ShowConsoleCheckBox.Checked)
            {
                this.TestsPanel.CssClass = "tests";
                this.FooterPanel.Visible = true;
            }
            else
            {
                this.TestsPanel.CssClass = "testsNoConsole";
                this.FooterPanel.Visible = false;
            }
        }
예제 #22
0
    void OnEnable()
    {
        BrowserUtility.OnEnable();

        this.minSize = new Vector2(600, 300);
        initGUIStyle = false;

        if (position.width < this.minSize.x || position.height < this.minSize.y)
        {
            position = new Rect(position.x, position.y, this.minSize.x, this.minSize.y);
        }

        LoadSkin();
    }
        public void BrowserUtilityTest()
        {
            var userAgent       = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36";
            var mockHttpRequest = new Mock <HttpRequest>();

            mockHttpRequest.Setup(z => z.Headers["User-Agent"])
            .Returns(userAgent);

            var result = BrowserUtility.GetUserAgent(mockHttpRequest.Object);

            Console.WriteLine(result);

            Assert.AreEqual(userAgent, result, true);
        }
예제 #24
0
    void DisplayFile(VCFile file, int index, bool staged, List <VCFile> filteredList)
    {
        if (index % 2 == 0)
        {
            GUI.backgroundColor = Color.gray;
        }
        else
        {
            GUI.backgroundColor = Color.white;
        }

        GUILayout.BeginHorizontal();
        string statusString   = file.fileState1 != FileState.Unmodified ? file.fileState1.ToString() : file.fileState2.ToString();
        string filePathString = !string.IsNullOrEmpty(file.path2) ? file.path2 : file.path1;
        bool   t1             = GUILayout.Toggle(file.selected, statusString, selectionStyle, GUILayout.Width(75));
        bool   t2             = false;

        if (viewMode != BrowserViewMode.ArtistMode)
        {
            string fileNameString = !string.IsNullOrEmpty(file.name2) ? file.name2 : file.name1;
            t2 = GUILayout.Toggle(file.selected, fileNameString, selectionStyle, GUILayout.Width(295));
        }
        bool t3 = GUILayout.Toggle(file.selected, filePathString, selectionStyle, GUILayout.ExpandWidth(true));

        GUILayout.EndHorizontal();

        GUI.backgroundColor = Color.white;

        if (viewMode != BrowserViewMode.ArtistMode && t2 != file.selected)
        {
            BrowserUtility.ValidateSelection(file, t2, false, index, lastSelectedIndex, filteredList);
            if (file.selected)
            {
                lastSelectedIndex = index;
            }
        }
        else if (t3 != file.selected)
        {
            BrowserUtility.ValidateSelection(file, t3, false, index, lastSelectedIndex, filteredList);
            lastSelectedIndex = file.selected ? index : -1;
        }
        else if (t1 != file.selected)
        {
            BrowserUtility.ValidateSelection(file, t1, false, index, lastSelectedIndex, filteredList);
            lastSelectedIndex = file.selected ? index : -1;
        }
    }
예제 #25
0
        public void TestCheckboxes2()
        {
            var Driver = new BrowserUtility().InitF(driver);
            //se crea un WebElement donde se guarda el radio1 para luego darle click
            IWebElement checkbox1 = Driver.FindElement(By.XPath("//input[@id='checkBoxOption1']"));

            checkbox1.Click();
            IWebElement checkbox2 = Driver.FindElement(By.XPath("//input[@id='checkBoxOption2']"));

            checkbox2.Click();
            IWebElement checkbox3 = Driver.FindElement(By.XPath("//input[@id='checkBoxOption3']"));

            checkbox3.Click();
            Assert.IsTrue(checkbox1.Selected);
            Assert.IsTrue(checkbox2.Selected);
            Assert.IsTrue(checkbox3.Selected);
            Driver.Close();
        }
예제 #26
0
        public ActionResult ProductItem(int productId, int hc)
        {
            dynamic job = new OrderService().GetOrderByOrderID(productId);

            if (job == null)
            {
                return(Content("商品信息不存在,或非法进入!2003"));
            }

            //判断是否正在微信端
            //if (BrowserUtility.BrowserUtility.SideInWeixinBrowser(HttpContext))
            if (BrowserUtility.SideInWeixinBrowser(HttpContext))
            {
                //正在微信端,直接跳转到微信支付页面
                return(RedirectToAction("JsApi", new { productId = productId, hc = hc }));
            }
            else
            {
                //在PC端打开,提供二维码扫描进行支付
                return(View(job));
            }
        }
예제 #27
0
        public ActionResult ProductItem(int productId, int hc)
        {
            var products = ProductModel.GetFakeProductList();
            var product  = products.FirstOrDefault(z => z.Id == productId);

            if (product == null || product.GetHashCode() != hc)
            {
                return(Content("商品信息不存在,或非法进入!2003"));
            }

            //判断是否正在微信端
            //if (BrowserUtility.BrowserUtility.SideInWeixinBrowser(HttpContext))
            if (BrowserUtility.SideInWeixinBrowser(HttpContext))
            {
                //正在微信端,直接跳转到微信支付页面
                return(RedirectToAction("JsApi", new { productId = productId, hc = hc }));
            }
            else
            {
                //在PC端打开,提供二维码扫描进行支付
                return(View(product));
            }
        }
예제 #28
0
 public TrendyolTest()
 {
     driverPath     = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
     browserUtility = new BrowserUtility();
 }
예제 #29
0
 public void Close()
 {
     extent.Flush();
     BrowserUtility.Close();
 }
예제 #30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Master.Page.Header.Controls.Add( ControlGenerator.GetScriptControl( "/Scripts/Ubio.js" ) );
            Master.Page.Header.Controls.Add(ControlGenerator.GetScriptControl("/Scripts/BotanicusDropInViewerUtils.js"));
            //Master.Page.Header.Controls.Add( ControlGenerator.GetScriptControl( "/Scripts/Highlighter.js" ) );

            pageListContentPanel.SetTableID("pageListTable");
            namesListContentPanel.SetTableID("nameListTable");
            //ControlGenerator.AddScriptControl(Page.Master.Page.Header.Controls, "/Scripts/ResizeContentPanelUtils.js");
            ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onload",
                                                              "SetContentPanelWidth('pageListTable', 250);SetContentPanelWidth('nameListTable', 250);");
            ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onresize", "resizeViewerHeight(157);");

            main.SetPageType(Main.PageType.TitleViewer);
            main.HideOverflow();

            if (!Page.IsPostBack)
            {
                PageSummaryView ps = null;

                if ((Request["BibId"] != null) &&
                    ((Request["volume"] != null) || (Request["issue"] != null) || (Request["year"] != null) ||
                     (Request["startpage"] != null)) &&
                    Request["resolved"] == null)
                {
                    Response.Redirect("PageResolve.aspx?" + Request.ServerVariables["QUERY_STRING"]);
                }

                if (ps == null)
                {
                    if (Request.QueryString["pageid"] != null)
                    {
                        int pageid;
                        if (int.TryParse(Request.QueryString["pageid"], out pageid))
                        {
                            ps = bhlProvider.PageSummarySelectByPageId(pageid);
                        }
                    }
                    else if (Request.QueryString["titleid"] != null)
                    {
                        int titleid;
                        if (int.TryParse(Request.QueryString["titleid"], out titleid))
                        {
                            // Check to make sure this title hasn't been replaced.  If it has, redirect
                            // to the appropriate titleid.
                            Title title = bhlProvider.TitleSelect(titleid);
                            if (title.RedirectTitleID != null)
                            {
                                Response.Redirect("/title/" + title.RedirectTitleID.ToString());
                                Response.End();
                            }

                            ps = bhlProvider.PageTitleSummarySelectByTitleId(titleid);
                        }
                    }
                    else if (Request.QueryString["itemid"] != null)
                    {
                        int itemid;
                        if (int.TryParse(Request.QueryString["itemid"], out itemid))
                        {
                            ps = bhlProvider.PageSummarySelectByItemId(itemid);
                        }
                    }
                    else if (Request["BibId"] != null)
                    {
                        ps = bhlProvider.PageTitleSummarySelectByBibID(Request["bibID"].ToString());
                    }
                    else if (Request["Barcode"] != null)
                    {
                        ps = bhlProvider.PageSummarySelectByBarcode(Request["Barcode"].ToString());
                    }
                    else if (Request["Prefix"] != null)
                    {
                        ps = bhlProvider.PageSummarySelectByPrefix(Request["Prefix"].ToString());
                    }
                }

                if (ps != null)
                {
                    hidItemID.Value = ps.ItemID.ToString();
                    ControlGenerator.AddAttributesAndPreserveExisting(main.Body, "onload",
                                                                      "changePage(" + ps.SequenceOrder + ");resizeViewerHeight(157);");
                }
                else
                {
                    // if our PageSummaryView is still null, then redirect because we couldn't find the requested title.
                    Response.Redirect("/TitleNotFound.aspx");
                    Response.End();
                }

                if (ps != null)
                {
                    Master.Page.Title = "Biodiversity Heritage Library: " + ps.ShortTitle;

                    // Set the item for the COinS
                    COinSControl1.ItemID = ps.ItemID;

                    CustomGenericList <MOBOT.BHL.DataObjects.Page> pages = bhlProvider.PageMetadataSelectByItemID(ps.ItemID);

                    pageListBox.DataTextField  = "WebDisplay";
                    pageListBox.DataValueField = "PageID";
                    pageListBox.DataSource     = pages;
                    pageListBox.DataBind();

                    int totalPageCount = bhlProvider.PageSelectCountByItemID(ps.ItemID);
                    hidSequenceMax.Value = totalPageCount.ToString();

                    hidPageID.Value    = ps.PageID.ToString();
                    pageLink.InnerText = "/page/" + ps.PageID.ToString();
                    titleVolumeSelectionControl.PopulateControl(ps);

                    Data.Institution institution = bhlProvider.InstitutionSelectByItemID(ps.ItemID);
                    if (institution != null)
                    {
                        if (institution.InstitutionUrl != null && institution.InstitutionUrl.Trim().Length > 0)
                        {
                            HyperLink link = new HyperLink();
                            link.Text        = institution.InstitutionName;
                            link.NavigateUrl = institution.InstitutionUrl;
                            link.Target      = "_blank";
                            attributionPlaceHolder.Controls.Add(link);
                        }
                        else
                        {
                            Literal literal = new Literal();
                            literal.Text = institution.InstitutionName;
                            attributionPlaceHolder.Controls.Add(literal);
                        }
                        string attributionDivAttributesString = "";
                        if (BrowserUtility.IsBrowserIE6OrBelow(Request))
                        {
                            attributionDivAttributesString = ConfigurationManager.AppSettings["attributionDivPropertiesIE6"];
                        }
                        else
                        {
                            attributionDivAttributesString = ConfigurationManager.AppSettings["attributionDivPropertiesDefault"];
                        }

                        string[] attributionDivAttributeParts = attributionDivAttributesString.Split('|');
                        attributionDiv.Style.Add("position", attributionDivAttributeParts[0]);
                        attributionDiv.Style.Add("bottom", attributionDivAttributeParts[1]);
                    }
                }
            }
        }