Discussion:
[Cucumber] Cucumber-JVM - execution issue
(too old to reply)
Den Dem
2017-07-21 12:12:26 UTC
Permalink
Raw Message
Hello,

I am facing issue as when I try to execute feature file with several
scenarios, for some reason after executing 1st scenario, browser does not
close in order to run next scenario.
It just sits on last step, but tries to execute rest of scenarios

However, if to run, single scenario, this works as expected.

I do not use @After hook as I am passing info in Runtime.addShutdownHook
with BrowserCleanup class

Added screenshots of framework structure with Browser setup and Webdriver
with BrowserCleanup class as well as log from execution.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Justin Radcliffe
2017-07-21 12:41:30 UTC
Permalink
Raw Message
I don't see a shot of your Hooks file but here's what mine looks like :

I think you'll want to put the shutdown hook within your @Before or @After
but that only when the jvm is shutdown. So I do the following to make sure
I dont leave the browser up at the end of all my test.

@Before
public void loginToGaa(Scenario scenario) {
almLogin();

if (!TagInfo.runThroughApi(scenario) && !isLoginCompleted()) {





*Runtime.getRuntime().addShutdownHook(new Thread() { public
void run() { LOGGER.debug("LOGGING OUT.");
new WindowsExecutionUtility().killChromeAndChromeDriver();
} });*
new WindowsExecutionUtility().killChromeAndChromeDriver();
LOGGER.debug("LOGGING IN");
gAAKeywords.OPEN_GAA("autURL");
gAAKeywords.LOGIN_TO_GAA("UserName", "Password");


PrepareReport.addReportPass(MessageConstants.LOGIN_TO_GAA);
setLoginCompleted(true);
}
}


if you want to have a new broswer at the end of each test, you should add
it in the @After

@After
public void wrapTest(Scenario scenario) {

try {
Driver.webdriver.quit();
} catch (Exception | Error e) {
LOGGER.error("wrapTest : "+e.getLocalizedMessage());
}

}
Post by Den Dem
Hello,
I am facing issue as when I try to execute feature file with several
scenarios, for some reason after executing 1st scenario, browser does not
close in order to run next scenario.
It just sits on last step, but tries to execute rest of scenarios
However, if to run, single scenario, this works as expected.
with BrowserCleanup class
Added screenshots of framework structure with Browser setup and Webdriver
with BrowserCleanup class as well as log from execution.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Den Dem
2017-07-21 12:54:55 UTC
Permalink
Raw Message
Hi Justin,
Yes, I added Hook screenshot. Please advise, so what you are saying it is
better to put addShutdown in @Beforehook and also add into @After
driver.quit?
Post by Justin Radcliffe
but that only when the jvm is shutdown. So I do the following to make sure
I dont leave the browser up at the end of all my test.
@Before
public void loginToGaa(Scenario scenario) {
almLogin();
if (!TagInfo.runThroughApi(scenario) && !isLoginCompleted()) {
*Runtime.getRuntime().addShutdownHook(new Thread() { public
void run() { LOGGER.debug("LOGGING OUT.");
new WindowsExecutionUtility().killChromeAndChromeDriver();
} });*
new WindowsExecutionUtility().killChromeAndChromeDriver();
LOGGER.debug("LOGGING IN");
gAAKeywords.OPEN_GAA("autURL");
gAAKeywords.LOGIN_TO_GAA("UserName", "Password");
PrepareReport.addReportPass(MessageConstants.LOGIN_TO_GAA);
setLoginCompleted(true);
}
}
if you want to have a new broswer at the end of each test, you should add
@After
public void wrapTest(Scenario scenario) {
try {
Driver.webdriver.quit();
} catch (Exception | Error e) {
LOGGER.error("wrapTest : "+e.getLocalizedMessage());
}
}
Post by Den Dem
Hello,
I am facing issue as when I try to execute feature file with several
scenarios, for some reason after executing 1st scenario, browser does not
close in order to run next scenario.
It just sits on last step, but tries to execute rest of scenarios
However, if to run, single scenario, this works as expected.
with BrowserCleanup class
Added screenshots of framework structure with Browser setup and Webdriver
with BrowserCleanup class as well as log from execution.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Den Dem
2017-07-21 13:08:23 UTC
Permalink
Raw Message
@Justin,
I tried to move addShutdown hook into @Before and for @After
Driver.webdriver.quit();

Tried to run, so after first scenario browser closed, but new instance of
the browser did not started for next scenario.
Post by Den Dem
Hi Justin,
Yes, I added Hook screenshot. Please advise, so what you are saying it is
driver.quit?
@After but that only when the jvm is shutdown. So I do the following to
make sure I dont leave the browser up at the end of all my test.
@Before
public void loginToGaa(Scenario scenario) {
almLogin();
if (!TagInfo.runThroughApi(scenario) && !isLoginCompleted()) {
*Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() { LOGGER.debug("LOGGING OUT.");
new WindowsExecutionUtility().killChromeAndChromeDriver();
} });*
new WindowsExecutionUtility().killChromeAndChromeDriver();
LOGGER.debug("LOGGING IN");
gAAKeywords.OPEN_GAA("autURL");
gAAKeywords.LOGIN_TO_GAA("UserName", "Password");
PrepareReport.addReportPass(MessageConstants.LOGIN_TO_GAA);
setLoginCompleted(true);
}
}
if you want to have a new broswer at the end of each test, you should add
@After
public void wrapTest(Scenario scenario) {
try {
Driver.webdriver.quit();
} catch (Exception | Error e) {
LOGGER.error("wrapTest : "+e.getLocalizedMessage());
}
}
Post by Den Dem
Hello,
I am facing issue as when I try to execute feature file with several
scenarios, for some reason after executing 1st scenario, browser does not
close in order to run next scenario.
It just sits on last step, but tries to execute rest of scenarios
However, if to run, single scenario, this works as expected.
with BrowserCleanup class
Added screenshots of framework structure with Browser setup and
Webdriver with BrowserCleanup class as well as log from execution.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Justin Radcliffe
2017-07-21 13:18:43 UTC
Permalink
Raw Message
You'll have to add WebdriverFactory.createWebdriver(); in your @Before
method and then it will create a new driver every run as well.
Post by Den Dem
@Justin,
Driver.webdriver.quit();
Tried to run, so after first scenario browser closed, but new instance of
the browser did not started for next scenario.
Post by Den Dem
Hi Justin,
Yes, I added Hook screenshot. Please advise, so what you are saying it is
driver.quit?
@After but that only when the jvm is shutdown. So I do the following to
make sure I dont leave the browser up at the end of all my test.
@Before
public void loginToGaa(Scenario scenario) {
almLogin();
if (!TagInfo.runThroughApi(scenario) && !isLoginCompleted()) {
*Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() { LOGGER.debug("LOGGING OUT.");
new WindowsExecutionUtility().killChromeAndChromeDriver();
} });*
new WindowsExecutionUtility().killChromeAndChromeDriver();
LOGGER.debug("LOGGING IN");
gAAKeywords.OPEN_GAA("autURL");
gAAKeywords.LOGIN_TO_GAA("UserName", "Password");
PrepareReport.addReportPass(MessageConstants.LOGIN_TO_GAA);
setLoginCompleted(true);
}
}
if you want to have a new broswer at the end of each test, you should
@After
public void wrapTest(Scenario scenario) {
try {
Driver.webdriver.quit();
} catch (Exception | Error e) {
LOGGER.error("wrapTest : "+e.getLocalizedMessage());
}
}
Post by Den Dem
Hello,
I am facing issue as when I try to execute feature file with several
scenarios, for some reason after executing 1st scenario, browser does not
close in order to run next scenario.
It just sits on last step, but tries to execute rest of scenarios
However, if to run, single scenario, this works as expected.
Runtime.addShutdownHook with BrowserCleanup class
Added screenshots of framework structure with Browser setup and
Webdriver with BrowserCleanup class as well as log from execution.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Den Dem
2017-07-21 13:34:52 UTC
Permalink
Raw Message
Yes, I added that in the @Before, execution goes after 1st scenario and
closes browser and initiated another instance, but url is not being passed
and browser instance sits and then for each scenario another instance of
browser opens without closing previous one with blank url.
Post by Justin Radcliffe
method and then it will create a new driver every run as well.
Post by Den Dem
@Justin,
Driver.webdriver.quit();
Tried to run, so after first scenario browser closed, but new instance of
the browser did not started for next scenario.
Post by Den Dem
Hi Justin,
Yes, I added Hook screenshot. Please advise, so what you are saying it
driver.quit?
@After but that only when the jvm is shutdown. So I do the following to
make sure I dont leave the browser up at the end of all my test.
@Before
public void loginToGaa(Scenario scenario) {
almLogin();
if (!TagInfo.runThroughApi(scenario) && !isLoginCompleted()) {
*Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() { LOGGER.debug("LOGGING OUT.");
new WindowsExecutionUtility().killChromeAndChromeDriver();
} });*
new WindowsExecutionUtility().killChromeAndChromeDriver();
LOGGER.debug("LOGGING IN");
gAAKeywords.OPEN_GAA("autURL");
gAAKeywords.LOGIN_TO_GAA("UserName", "Password");
PrepareReport.addReportPass(MessageConstants.LOGIN_TO_GAA);
setLoginCompleted(true);
}
}
if you want to have a new broswer at the end of each test, you should
@After
public void wrapTest(Scenario scenario) {
try {
Driver.webdriver.quit();
} catch (Exception | Error e) {
LOGGER.error("wrapTest : "+e.getLocalizedMessage());
}
}
Post by Den Dem
Hello,
I am facing issue as when I try to execute feature file with several
scenarios, for some reason after executing 1st scenario, browser does not
close in order to run next scenario.
It just sits on last step, but tries to execute rest of scenarios
However, if to run, single scenario, this works as expected.
Runtime.addShutdownHook with BrowserCleanup class
Added screenshots of framework structure with Browser setup and
Webdriver with BrowserCleanup class as well as log from execution.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Den Dem
2017-07-21 14:21:27 UTC
Permalink
Raw Message
I forgot to mention as I have Driver class

public class Driver {

public static WebDriver webdriver;

public synchronized static WebDriver getCurrentDriver() {

if (webdriver == null) {
webdriver = WebdriverFactory.createWebdriver();
webdriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
webdriver.manage().timeouts().pageLoadTimeout(100, TimeUnit.SECONDS);
}
return webdriver;
}


tha is used in

action classes

public class Expedia_Action extends Config {


static WebDriver driver = Driver.getCurrentDriver();

static WebDriverWait wait = new WebDriverWait(driver, 10);

public static void searchForFlight(String flightOrigin, String flightDestination) throws InterruptedException {
driver.get(expedia_baseUrl);


it has

webdriver = WebdriverFactory.createWebdriver();


so I do nto think I need to add same into @Before hook as it is initiated
or no?
Post by Den Dem
closes browser and initiated another instance, but url is not being passed
and browser instance sits and then for each scenario another instance of
browser opens without closing previous one with blank url.
Post by Justin Radcliffe
method and then it will create a new driver every run as well.
Post by Den Dem
@Justin,
Driver.webdriver.quit();
Tried to run, so after first scenario browser closed, but new instance
of the browser did not started for next scenario.
Post by Den Dem
Hi Justin,
Yes, I added Hook screenshot. Please advise, so what you are saying it
driver.quit?
@After but that only when the jvm is shutdown. So I do the following to
make sure I dont leave the browser up at the end of all my test.
@Before
public void loginToGaa(Scenario scenario) {
almLogin();
if (!TagInfo.runThroughApi(scenario) && !isLoginCompleted()) {
*Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() { LOGGER.debug("LOGGING OUT.");
new WindowsExecutionUtility().killChromeAndChromeDriver();
} });*
new WindowsExecutionUtility().killChromeAndChromeDriver();
LOGGER.debug("LOGGING IN");
gAAKeywords.OPEN_GAA("autURL");
gAAKeywords.LOGIN_TO_GAA("UserName", "Password");
PrepareReport.addReportPass(MessageConstants.LOGIN_TO_GAA
);
setLoginCompleted(true);
}
}
if you want to have a new broswer at the end of each test, you should
@After
public void wrapTest(Scenario scenario) {
try {
Driver.webdriver.quit();
} catch (Exception | Error e) {
LOGGER.error("wrapTest : "+e.getLocalizedMessage());
}
}
Post by Den Dem
Hello,
I am facing issue as when I try to execute feature file with several
scenarios, for some reason after executing 1st scenario, browser does not
close in order to run next scenario.
It just sits on last step, but tries to execute rest of scenarios
However, if to run, single scenario, this works as expected.
Runtime.addShutdownHook with BrowserCleanup class
Added screenshots of framework structure with Browser setup and
Webdriver with BrowserCleanup class as well as log from execution.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Justin Radcliffe
2017-07-21 15:34:30 UTC
Permalink
Raw Message
However you are able to get the url and broswer, you can move that to the
Before hook.
Post by Den Dem
I forgot to mention as I have Driver class
public class Driver {
public static WebDriver webdriver;
public synchronized static WebDriver getCurrentDriver() {
if (webdriver == null) {
webdriver = WebdriverFactory.createWebdriver();
webdriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
webdriver.manage().timeouts().pageLoadTimeout(100, TimeUnit.SECONDS);
}
return webdriver;
}
tha is used in
action classes
public class Expedia_Action extends Config {
static WebDriver driver = Driver.getCurrentDriver();
static WebDriverWait wait = new WebDriverWait(driver, 10);
public static void searchForFlight(String flightOrigin, String flightDestination) throws InterruptedException {
driver.get(expedia_baseUrl);
it has
webdriver = WebdriverFactory.createWebdriver();
or no?
Post by Den Dem
closes browser and initiated another instance, but url is not being passed
and browser instance sits and then for each scenario another instance of
browser opens without closing previous one with blank url.
Post by Justin Radcliffe
method and then it will create a new driver every run as well.
Post by Den Dem
@Justin,
Driver.webdriver.quit();
Tried to run, so after first scenario browser closed, but new instance
of the browser did not started for next scenario.
Post by Den Dem
Hi Justin,
Yes, I added Hook screenshot. Please advise, so what you are saying it
driver.quit?
@After but that only when the jvm is shutdown. So I do the following to
make sure I dont leave the browser up at the end of all my test.
@Before
public void loginToGaa(Scenario scenario) {
almLogin();
if (!TagInfo.runThroughApi(scenario) && !isLoginCompleted()) {
*Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() { LOGGER.debug("LOGGING OUT.");
new WindowsExecutionUtility().killChromeAndChromeDriver();
} });*
new WindowsExecutionUtility().killChromeAndChromeDriver
();
LOGGER.debug("LOGGING IN");
gAAKeywords.OPEN_GAA("autURL");
gAAKeywords.LOGIN_TO_GAA("UserName", "Password");
PrepareReport.addReportPass(MessageConstants.LOGIN_TO_GAA
);
setLoginCompleted(true);
}
}
if you want to have a new broswer at the end of each test, you should
@After
public void wrapTest(Scenario scenario) {
try {
Driver.webdriver.quit();
} catch (Exception | Error e) {
LOGGER.error("wrapTest : "+e.getLocalizedMessage());
}
}
Post by Den Dem
Hello,
I am facing issue as when I try to execute feature file with several
scenarios, for some reason after executing 1st scenario, browser does not
close in order to run next scenario.
It just sits on last step, but tries to execute rest of scenarios
However, if to run, single scenario, this works as expected.
Runtime.addShutdownHook with BrowserCleanup class
Added screenshots of framework structure with Browser setup and
Webdriver with BrowserCleanup class as well as log from execution.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to a topic in the
Google Groups "Cukes" group.
To unsubscribe from this topic, visit https://groups.google.com/d/
topic/cukes/FeZ9EZSqfTk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
For more options, visit https://groups.google.com/d/optout.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Den Dem
2017-07-21 17:01:59 UTC
Permalink
Raw Message
I able to get for 1st scenario only, rest are having blank urls. Passing
url is first step within scenario
Post by Justin Radcliffe
However you are able to get the url and broswer, you can move that to the
Before hook.
Post by Den Dem
I forgot to mention as I have Driver class
public class Driver {
public static WebDriver webdriver;
public synchronized static WebDriver getCurrentDriver() {
if (webdriver == null) {
webdriver = WebdriverFactory.createWebdriver();
webdriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
webdriver.manage().timeouts().pageLoadTimeout(100, TimeUnit.SECONDS);
}
return webdriver;
}
tha is used in
action classes
public class Expedia_Action extends Config {
static WebDriver driver = Driver.getCurrentDriver();
static WebDriverWait wait = new WebDriverWait(driver, 10);
public static void searchForFlight(String flightOrigin, String flightDestination) throws InterruptedException {
driver.get(expedia_baseUrl);
it has
webdriver = WebdriverFactory.createWebdriver();
or no?
Post by Den Dem
closes browser and initiated another instance, but url is not being passed
and browser instance sits and then for each scenario another instance of
browser opens without closing previous one with blank url.
Post by Justin Radcliffe
method and then it will create a new driver every run as well.
Post by Den Dem
@Justin,
Driver.webdriver.quit();
Tried to run, so after first scenario browser closed, but new instance
of the browser did not started for next scenario.
Post by Den Dem
Hi Justin,
Yes, I added Hook screenshot. Please advise, so what you are saying
driver.quit?
@After but that only when the jvm is shutdown. So I do the following to
make sure I dont leave the browser up at the end of all my test.
@Before
public void loginToGaa(Scenario scenario) {
almLogin();
if (!TagInfo.runThroughApi(scenario) && !isLoginCompleted()) {
*Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() { LOGGER.debug("LOGGING OUT.");
new WindowsExecutionUtility().killChromeAndChromeDriver();
} });*
new WindowsExecutionUtility().killChromeAndChromeDriver
();
LOGGER.debug("LOGGING IN");
gAAKeywords.OPEN_GAA("autURL");
gAAKeywords.LOGIN_TO_GAA("UserName", "Password");
PrepareReport.addReportPass(MessageConstants.
LOGIN_TO_GAA);
setLoginCompleted(true);
}
}
if you want to have a new broswer at the end of each test, you
@After
public void wrapTest(Scenario scenario) {
try {
Driver.webdriver.quit();
} catch (Exception | Error e) {
LOGGER.error("wrapTest : "+e.getLocalizedMessage());
}
}
Post by Den Dem
Hello,
I am facing issue as when I try to execute feature file with
several scenarios, for some reason after executing 1st scenario, browser
does not close in order to run next scenario.
It just sits on last step, but tries to execute rest of scenarios
However, if to run, single scenario, this works as expected.
Runtime.addShutdownHook with BrowserCleanup class
Added screenshots of framework structure with Browser setup and
Webdriver with BrowserCleanup class as well as log from execution.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to a topic in the
Google Groups "Cukes" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/cukes/FeZ9EZSqfTk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
For more options, visit https://groups.google.com/d/optout.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Justin Radcliffe
2017-07-21 19:17:04 UTC
Permalink
Raw Message
Got it, I think you just have to change how you setup your login method and
how you pull the URL from your constant/property.

Hopefully the point of closing and getting a new driver each scenario is at
least resolved.
Post by Den Dem
I able to get for 1st scenario only, rest are having blank urls. Passing
url is first step within scenario
Post by Justin Radcliffe
However you are able to get the url and broswer, you can move that to the
Before hook.
Post by Den Dem
I forgot to mention as I have Driver class
public class Driver {
public static WebDriver webdriver;
public synchronized static WebDriver getCurrentDriver() {
if (webdriver == null) {
webdriver = WebdriverFactory.createWebdriver();
webdriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
webdriver.manage().timeouts().pageLoadTimeout(100, TimeUnit.SECONDS);
}
return webdriver;
}
tha is used in
action classes
public class Expedia_Action extends Config {
static WebDriver driver = Driver.getCurrentDriver();
static WebDriverWait wait = new WebDriverWait(driver, 10);
public static void searchForFlight(String flightOrigin, String flightDestination) throws InterruptedException {
driver.get(expedia_baseUrl);
it has
webdriver = WebdriverFactory.createWebdriver();
initiated or no?
Post by Den Dem
closes browser and initiated another instance, but url is not being passed
and browser instance sits and then for each scenario another instance of
browser opens without closing previous one with blank url.
Post by Justin Radcliffe
You'll have to add WebdriverFactory.createWebdriver(); in your
@Before method and then it will create a new driver every run as well.
Post by Den Dem
@Justin,
Driver.webdriver.quit();
Tried to run, so after first scenario browser closed, but new
instance of the browser did not started for next scenario.
Post by Den Dem
Hi Justin,
Yes, I added Hook screenshot. Please advise, so what you are saying
driver.quit?
@After but that only when the jvm is shutdown. So I do the following to
make sure I dont leave the browser up at the end of all my test.
@Before
public void loginToGaa(Scenario scenario) {
almLogin();
if (!TagInfo.runThroughApi(scenario) && !isLoginCompleted
()) {
*Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() { LOGGER.debug("LOGGING OUT.");
new WindowsExecutionUtility().killChromeAndChromeDriver();
} });*
new WindowsExecutionUtility().killChromeAndChromeDriver
();
LOGGER.debug("LOGGING IN");
gAAKeywords.OPEN_GAA("autURL");
gAAKeywords.LOGIN_TO_GAA("UserName", "Password");
PrepareReport.addReportPass(MessageConstants.
LOGIN_TO_GAA);
setLoginCompleted(true);
}
}
if you want to have a new broswer at the end of each test, you
@After
public void wrapTest(Scenario scenario) {
try {
Driver.webdriver.quit();
} catch (Exception | Error e) {
LOGGER.error("wrapTest : "+e.getLocalizedMessage());
}
}
Post by Den Dem
Hello,
I am facing issue as when I try to execute feature file with
several scenarios, for some reason after executing 1st scenario, browser
does not close in order to run next scenario.
It just sits on last step, but tries to execute rest of scenarios
However, if to run, single scenario, this works as expected.
Runtime.addShutdownHook with BrowserCleanup class
Added screenshots of framework structure with Browser setup and
Webdriver with BrowserCleanup class as well as log from execution.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to a topic in the
Google Groups "Cukes" group.
To unsubscribe from this topic, visit https://groups.google.com/d/to
pic/cukes/FeZ9EZSqfTk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
For more options, visit https://groups.google.com/d/optout.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Den Dem
2017-07-21 23:59:08 UTC
Permalink
Raw Message
I thought so, would you have a good template for such?
Post by Justin Radcliffe
Got it, I think you just have to change how you setup your login method
and how you pull the URL from your constant/property.
Hopefully the point of closing and getting a new driver each scenario is
at least resolved.
Post by Den Dem
I able to get for 1st scenario only, rest are having blank urls. Passing
url is first step within scenario
Post by Justin Radcliffe
However you are able to get the url and broswer, you can move that to
the Before hook.
Post by Den Dem
I forgot to mention as I have Driver class
public class Driver {
public static WebDriver webdriver;
public synchronized static WebDriver getCurrentDriver() {
if (webdriver == null) {
webdriver = WebdriverFactory.createWebdriver();
webdriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
webdriver.manage().timeouts().pageLoadTimeout(100, TimeUnit.SECONDS);
}
return webdriver;
}
tha is used in
action classes
public class Expedia_Action extends Config {
static WebDriver driver = Driver.getCurrentDriver();
static WebDriverWait wait = new WebDriverWait(driver, 10);
public static void searchForFlight(String flightOrigin, String flightDestination) throws InterruptedException {
driver.get(expedia_baseUrl);
it has
webdriver = WebdriverFactory.createWebdriver();
initiated or no?
and closes browser and initiated another instance, but url is not being
passed and browser instance sits and then for each scenario another
instance of browser opens without closing previous one with blank url.
Post by Justin Radcliffe
You'll have to add WebdriverFactory.createWebdriver(); in your
@Before method and then it will create a new driver every run as well.
Post by Den Dem
@Justin,
Driver.webdriver.quit();
Tried to run, so after first scenario browser closed, but new
instance of the browser did not started for next scenario.
Post by Den Dem
Hi Justin,
Yes, I added Hook screenshot. Please advise, so what you are saying
driver.quit?
make sure I dont leave the browser up at the end of all my test.
@Before
public void loginToGaa(Scenario scenario) {
almLogin();
if (!TagInfo.runThroughApi(scenario) && !isLoginCompleted
()) {
*Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() { LOGGER.debug("LOGGING OUT.");
new WindowsExecutionUtility().killChromeAndChromeDriver();
} });*
new WindowsExecutionUtility().
killChromeAndChromeDriver();
LOGGER.debug("LOGGING IN");
gAAKeywords.OPEN_GAA("autURL");
gAAKeywords.LOGIN_TO_GAA("UserName", "Password");
PrepareReport.addReportPass(MessageConstants.
LOGIN_TO_GAA);
setLoginCompleted(true);
}
}
if you want to have a new broswer at the end of each test, you
@After
public void wrapTest(Scenario scenario) {
try {
Driver.webdriver.quit();
} catch (Exception | Error e) {
LOGGER.error("wrapTest : "+e.getLocalizedMessage());
}
}
Post by Den Dem
Hello,
I am facing issue as when I try to execute feature file with
several scenarios, for some reason after executing 1st scenario, browser
does not close in order to run next scenario.
It just sits on last step, but tries to execute rest of scenarios
However, if to run, single scenario, this works as expected.
Runtime.addShutdownHook with BrowserCleanup class
Added screenshots of framework structure with Browser setup and
Webdriver with BrowserCleanup class as well as log from execution.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to a topic in the
Google Groups "Cukes" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/cukes/FeZ9EZSqfTk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
For more options, visit https://groups.google.com/d/optout.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...