-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBestJobsFirstPage.java
More file actions
82 lines (68 loc) · 3.03 KB
/
Copy pathBestJobsFirstPage.java
File metadata and controls
82 lines (68 loc) · 3.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package gheckodrivertest;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.logging.*;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import java.util.logging.Level;
/**
* @author andad
*/
public class BestJobsFirstPage {
private static WebDriver driver;
public static void main(String[] args) // TODO code application logic here
{
try {
//System.setProperty("webdriver.gecko.driver", "D:\\Documentatie\\Selenium\\geckodriver\\geckodriver.exe");
System.setProperty("webdriver.gecko.driver", "D:\\gdrwrapper.bat");
System.setProperty("webdriver.gecko.logfile", "D:\\geckodriver.log");
WebDriver driver = new FirefoxDriver();
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
LoggingPreferences logPrefs = new LoggingPreferences();
logPrefs.enable(LogType.BROWSER, Level.ALL);
logPrefs.enable(LogType.CLIENT, Level.ALL);
logPrefs.enable(LogType.DRIVER, Level.ALL);
logPrefs.enable(LogType.SERVER, Level.ALL);
logPrefs.enable(LogType.PERFORMANCE, Level.ALL);
capabilities.setCapability(CapabilityType.LOGGING_PREFS,
logPrefs);
driver.get("http:\\bestjobs.eu");
WebElement btnEnter = driver.findElement(By.xpath("html/body/div[1]/div/div/div/div/div[2]/a/button"));
btnEnter.click();
//driver.manage().timeouts().wait(30);
System.out.println(driver.getTitle());
/**
* <li
* class="sign-up-switch amplitude" data - key = "sign_up_email_started"
* > <a
* href = "/en/register" > Register < / a
* > < / li
* >
*/
// WebElement liSignIn = driver.findElement(By.className("sign-up-switch amplitude"));
By btnRegister = By.linkText("Register");
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.presenceOfElementLocated(btnRegister));
WebElement anchSignIn = driver.findElement(By.linkText("Register"));
anchSignIn.click();
//driver.manage().timeouts().wait(30);
Logs logs = driver.manage().logs();
LogEntries logEntries = logs.get(LogType.BROWSER);
for (LogEntry logEntry : logEntries) {
System.out.println("browser entry: " + logEntry.getMessage());
}
//driver.quit();
} catch (Exception ex) {
ex.printStackTrace();
}
}
}