Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3942352
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:39:09+00:00 2026-05-20T00:39:09+00:00

Here’s the situation that I’m working with: Build tests in Selenium Get all the

  • 0

Here’s the situation that I’m working with:

  • Build tests in Selenium
  • Get all the tests running correctly (in Firefox)
  • Export all the tests to MSTest (so that each test can be run in IE, Chrome and FF)
  • If any test needs to be modified, do that editing in Selenium IDE

So it’s a very one-way workflow. However, I’d now like to do a bit more automation. For instance, I’d like every test to run under each of two accounts. I’m getting into a maintenance issue. If I have 6 tests that I want to run under two accounts, suddenly I’d need 12 tests in the Selenium IDE tests. That’s too much editing. But a ton of that code is exactly the same.

How can I share chunks of Selenium tests among tests? Should I use Selenium IDE to develop the test first time then never use it again (only doing edits in VS after that)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T00:39:10+00:00Added an answer on May 20, 2026 at 12:39 am

    Selenium code is very linear after you export it from the IDE.

    For example (ignore syntax):

      someTestMethod() {
         selenium.open("http://someLoginPage.com");
         selenium.type("usernameField", "foo");
         selenium.type("passwordField", "bar");
         selenium.click("loginButton");
         selenium.waitForPageToLoad("30000");
         assertTrue(selenium.isTextPresent("Welcome * foo"));
      }
    

    This is the login page. Every single one of your tests will have to use it. You should refactor it into a method.

      someTestMethod(){
         selenium.open("http://someLoginPage.com");
         String username = "foo";
         String password = "bar";
         performLogin(username, password);
      }
    
      performLogin(String username, String password){
          selenium.type("usernameField", username);
          selenium.type("passwordField", password);
          selenium.click("loginButton");
          selenium.waitForPageToLoad("30000");
          assertTrue(selenium.isTextPresent("Welcome * foo"));
      }
    

    The performLogin() method does not have to be in the same file as your test code itself. You can create a separate class for it with your methods and share it between your tests.

    We have classes that correspond to certain functionalities on our UI. For example, we have many ways to search in our app. All methods that helps you with search functionality will be in the SearchUtil class.

    Structuring your tests similarly will give you the following advantages:

    • If the UI changes (an id of a field), you go to your one method, update the id and you are good to go
    • If the flow of your logic changes you also have only one place to update
    • To test whether your changes worked, you only have to run one of the tests to verify. All other tests use the same code so it should work.
    • A lot more expressive as you look at the code. With well named methods, you create a higher level of abstraction that is easier to read and understand.
    • Flexible and extensible! The possibilities are limitless. At this point you can use conditions, loops, exceptions, you can do your own reporting, etc…

    This website is an excellent resource on what you are trying to accomplish.

    Good Luck!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my scenario. I have a website running under AppPool1 and that works
Here's what I'm trying to accomplish with this program: a recursive method that checks
here is my configuration: http://domain.com (obviously fictitious name...) hosted on a server running Apache
Here is the problem that I am trying to solve. I have two folders
Here is a code snippet I was working with: int *a; int p =
Here is my program to find all the subsets of given set. To solve
Here's a query that works fine: SELECT rowid as msg_rowid, a, b, c FROM
Here is my code (Say we have a single button on the page that
Here's the flow that I am trying to achieve: 1) User uploads an audio
Here is what I have, but it is not working: if(window.width() < 1000) document.getElementsByTagName('body')[0].id=be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.