Hi,
I was working on some simple automatic test cases using selenium in my Bit bucket pipeline Below is my yml
image: maven:3.6.1
#!yaml
options:
max-time: 10 # configure default 10 minute timeout
pipelines:
default:
- step:
caches:
- maven
script: # Modify the commands below to build your repository.
- mvn -Dtest=ApplicationTests test
when executing -mvn -Dtest==ApplicationTests test in my cmd, the test cases are executing absolutely fine but when I exectue the same command in pipeline I'm geitting the below exception
<span>2020-04-24 15:55:11.690 ERROR 92 --- [ null to remote] org.openqa.selenium.os.OsProcess : org.apache.commons.exec.ExecuteException: Process exited with an error: 127 (Exit value: 127)</span><span><strong>org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start</strong>.</span><span>Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'</span><span>System info: host: '952e449d-6cd1-4feb-8f33-d76b1a81eb7c-47n4q', ip: '10.38.40.85', <a href="http://os.name/" target="_blank" rel="noopener nofollow noreferrer">os.name</a>: 'Linux', os.arch: 'amd64', os.version: '4.19.95-flatcar', java.version: '11.0.4'</span>Driver info: driver.version: ChromeDriver
From the exception, it can be understood that the exception is caused due to time out. Now the question is, is there a way to increase the timeout so that it waits for some time for the server to start? Below is my code:
@SpringBootTest
class ApplicationTests {
private WebDriver driver;
@Test
void contextLoads() {
System.out.println("Hello!!");
try {
WebDriverManager.chromedriver().setup();
//System.setProperty("webdriver.chrome.driver", "C:\\Users\\Akhil\\Desktop\\Selenium\\chromedriver.exe");
driver = new ChromeDriver();
driver.manage().deleteAllCookies();
driver.manage().window().maximize();
//Page synchronization
driver.manage().timeouts().implicitlyWait(100, TimeUnit.SECONDS);
driver.manage().timeouts().pageLoadTimeout(100, TimeUnit.SECONDS);
driver.get("http://www.edureka.co");
}
catch(Exception e){
e.printStackTrace();
}
}
}
Thanks in advance.
Akhil.