C# Selenium - one ChromeDriver for multiple forms? -
i have few forms , i'd have them operating on 1 webdriver. somehow possible? tried creating driver in new class couldnt pass forms.
code in form:
selenium1 sel = new selenium1(); sel.create(); chromedriver driver = sel.get();
class code:
namespace vulcan2 { public class selenium1 { chromedriver driverx; public void create() { chromedriver driverx = new chromedriver(); } public chromedriver driver() { return driverx; } } }
you can turn driver class static class:
static public class selenium1 { static chromedriver driverx; static public void create() { driverx = new chromedriver(); } static public chromedriver driver() { return driverx; } }
and may call this:
selenium1.driver().close();
Comments
Post a Comment