java - Webdriver is not passing from one method to another -


i'm using code below. test priority 1 executed successfully, code written under @test priority 2 not execution.

basically, webdriver passing test. if write code under first test, executed successfully.

import javax.swing.plaf.basic.basictabbedpaneui.tabselectionhandler;  import org.junit.assert; import org.junit.beforeclass; import org.openqa.selenium.by; import org.openqa.selenium.keys; import org.openqa.selenium.webdriver; import org.openqa.selenium.webelement; import org.openqa.selenium.chrome.chromedriver; import org.openqa.selenium.interactions.actions; import org.openqa.selenium.support.ui.expectedcondition; import org.openqa.selenium.support.ui.expectedconditions; import org.openqa.selenium.support.ui.webdriverwait; import org.testng.annotations.test; import org.testng.asserts.*;    public class nonvodafone_testng  {     public static webdriver driver;     public static webdriverwait wait;      @test(priority=1)     public void authorizeurl() throws interruptedexception      {         system.setproperty("webdriver.chrome.driver", "c:\\users\\singha28\\documents\\abhimanyu_office_backup\\softwares\\chromedriver_win32\\chromedriver.exe");         chromedriver driver = new chromedriver();         driver.manage().window().maximize();                 driver.get("https://dev.id.vodafone.com/mockup/");          //generating authorize url           driver.findelement(by.id("env_idp")).sendkeys("preprod");         driver.findelement(by.id("opco")).sendkeys("nv");         driver.findelement(by.id("btn_debug_url")).click();         driver.get(driver.findelement(by.id("txt_url")).getattribute("value"));         thread.sleep(5000);         driver.findelement(by.id("button")).click();     }      @test(priority=2)     public void landingpage()     {            //assert.assertequals(true, driver.findelement(by.xpath("//*[@id='form']/div[1]/div[1]/label")).isdisplayed());         system.out.println(driver.getcurrenturl());     }  } 

at authorizeurl(), declare new variable chromedriver driver in method's scope. have assign class property webdriver driver.

@test(priority=1)     public void authorizeurl() throws interruptedexception      {         system.setproperty("webdriver.chrome.driver", "c:\\users\\singha28\\documents\\abhimanyu_office_backup\\softwares\\chromedriver_win32\\chromedriver.exe");         nonvodafone_testng.driver = new chromedriver(); // <-- here 

Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -