Page transitions in selenium webdriver

Asked 2 years ago, Updated 2 years ago, 154 views

After logging in using WebDriver and logging in at the login screen,
I would like to transition to another page on that browser page, but I am troubled that it does not.

The following sources

login function
    static void login (IWebDriver_webDriver) {
            _webDriver.Url="url1";//
            IWebElement loginID=_webDriver.FindElement(By.Name("login_id"));
            IWebElement password=_webDriver.FindElement(By.Name("password"));
            IWebElement submit=_webDriver.FindElement(By.ClassName("classname"));
            loginID.SendKeys("loginID");
            password.SendKeys("password");
            submit.SendKeys(Keys.Return);
        }


after the above processing Call the following functions:

page transition function
    static void nextPage(IWebDriver_webDriver){
            string url = "url2";
            _webDriver.Url=url;
            //_webDriver.Navigate().GoToUrl(url);
        }

The following is the process of the main function:

handling main
  static void Main (string[]args)
        {     
            IWebDrive = new InternetExplorerDriver();
            login(ie);
            nextPage(ie);
        }

The page transition function has been processed and there are no errors, but
There is no transition.

IWebDriverie=new InternetExplorerDriver();
If you declare within each function, both pages are
It opens, but the pages are separated and opened, and url2 needs to log in.
I can't open the page, so it says log in.

If you know any of them
I look forward to hearing from you.
Thank you for your cooperation.

c# internet-explorer selenium selenium-webdriver

2022-09-30 19:39

2 Answers

IWebElement submit=_webDriver.FindElement(By.ClassName("classname"));

Is this the submit button?

submit.Click();

Then, won't it move?


2022-09-30 19:39

Does login() work alone?

*There is already a comment, but I think you should click on the button.

Assuming that login() is operating alone (it looks like it is), I think there is not enough time to meet (server side and browser) login process completion.

After submitting your credentials, you should confirm "Login Complete" and then leave login().


2022-09-30 19:39

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.