Here is my existing code:
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.Select;
public class VirginTrains {
public static void main(String[] args) throws InterruptedException {
String projectPath = System.getProperty("user.dir");
System.out.println("projectPath : " + projectPath);
// THE FOLLOWING CODE IS FOR 1.Journey details
//Opens virgin trains web page
System.setProperty("webdriver.chrome.driver", projectPath +
"\\drivers\\chromedriver\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("https://www.virgintrains.co.uk/");
//The following maximise the screen size
driver.manage().window().maximize();
In the following code I would like to select Arriving by in the drop down
// click to open the date time picker calendar - 4th Box
Actions actions1 = new Actions(driver);
WebElement departArrive =
driver.findElement(By.cssSelector("span[class='dropdownLabel']"));
actions1.doubleClick(departArrive).perform();
driver.findElement(By.cssSelector("span[class='dropdownLabel']")).click();
driver.findElement(By.cssSelector("css=input.Arriving by")).click();
Once the code runs it should select Arriving by