import java.awt.Desktop; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class theurl { public static void main(String[] args) { String url = "http://www.playok.com/en/spades/"; if(Desktop.isDesktopSupported()){ Desktop desktop = Desktop.getDesktop(); try { desktop.browse(new URI(url)); } catch (IOException | URISyntaxException e) { e.printStackTrace(); } }else{ Runtime runtime = Runtime.getRuntime(); try { runtime.exec("xdg-open " + url); } catch (IOException e) { e.printStackTrace(); } } }
WebDriver Driver = new ChromeDriver(); Driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); String url = "http://www.playok.com/en/spades/"; Driver.get(url); Driver.findElement(By.id("cookie_action_close_header")).click(); System.out.println("completed");
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)