Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.openqa.selenium.By;
- import org.openqa.selenium.WebDriver;
- import org.openqa.selenium.WebElement;
- import org.openqa.selenium.chrome.ChromeDriver;
- import java.util.List;
- public class Gustik {
- enum Currencies {
- EUR,
- AUD,
- CAD
- }
- public static void main(String[] args) {
- Currencies currency = Currencies.AUD;
- System.setProperty(
- "webdriver.chrome.driver",
- "D:\\School\\chromedriver.exe");
- WebDriver webDriver = new ChromeDriver();
- webDriver.navigate().to("https://www.sberbank.cz/");
- webDriver.findElement(By.xpath("//a[@href='/cs-cz/poplatky-a-sazby/kurzy']")).click();
- WebElement table = webDriver.findElement(By.xpath("//table"));
- List<WebElement> tableCells = table.findElements(By.xpath("//th"));
- int index = -9;
- for (WebElement tableCell : tableCells) {
- ++index;
- if (tableCell.getText().equals(currency.name())) {
- System.out.println(table.findElement(By.xpath("//tr[" + (index + 1) + "]//td[1]")).getText());
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment