|
@@ -14,9 +14,12 @@ import java.util.logging.Level;
|
|
|
import java.util.logging.Logger;
|
|
import java.util.logging.Logger;
|
|
|
|
|
|
|
|
import org.openqa.selenium.By;
|
|
import org.openqa.selenium.By;
|
|
|
|
|
+import org.openqa.selenium.Platform;
|
|
|
import org.openqa.selenium.StaleElementReferenceException;
|
|
import org.openqa.selenium.StaleElementReferenceException;
|
|
|
import org.openqa.selenium.WebElement;
|
|
import org.openqa.selenium.WebElement;
|
|
|
|
|
+import org.openqa.selenium.chrome.ChromeDriver;
|
|
|
import org.openqa.selenium.chrome.ChromeOptions;
|
|
import org.openqa.selenium.chrome.ChromeOptions;
|
|
|
|
|
+import org.openqa.selenium.remote.DesiredCapabilities;
|
|
|
import org.openqa.selenium.remote.RemoteWebDriver;
|
|
import org.openqa.selenium.remote.RemoteWebDriver;
|
|
|
import org.openqa.selenium.support.ui.ExpectedConditions;
|
|
import org.openqa.selenium.support.ui.ExpectedConditions;
|
|
|
import org.openqa.selenium.support.ui.WebDriverWait;
|
|
import org.openqa.selenium.support.ui.WebDriverWait;
|
|
@@ -232,8 +235,10 @@ public class OddsPortal extends ParserBase implements ParserJoinedFunctions {
|
|
|
|
|
|
|
|
private void setGameDate(ResultDTO result, WebElement firstResultsDiv) {
|
|
private void setGameDate(ResultDTO result, WebElement firstResultsDiv) {
|
|
|
final List<Integer> time = new ArrayList<>();
|
|
final List<Integer> time = new ArrayList<>();
|
|
|
- if (checkIfElementExists(firstResultsDiv, "./div/a/div[1]/div/p")) {
|
|
|
|
|
- String timeText = firstResultsDiv.findElement(By.xpath("./div/a/div[1]/div/p")).getText();
|
|
|
|
|
|
|
+ // String datePath = "./div/a/div[1]/div/p";
|
|
|
|
|
+ String datePath = "./div/div/div/div/p";
|
|
|
|
|
+ if (checkIfElementExists(firstResultsDiv, datePath)) {
|
|
|
|
|
+ String timeText = firstResultsDiv.findElement(By.xpath(datePath)).getText();
|
|
|
String[] timeSplit = timeText.split(":");
|
|
String[] timeSplit = timeText.split(":");
|
|
|
if (timeSplit.length == 2) {
|
|
if (timeSplit.length == 2) {
|
|
|
time.add(Integer.parseInt(timeSplit[0]));
|
|
time.add(Integer.parseInt(timeSplit[0]));
|
|
@@ -254,12 +259,16 @@ public class OddsPortal extends ParserBase implements ParserJoinedFunctions {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void setOdds(ResultDTO result, WebElement firstResultsDiv) {
|
|
private void setOdds(ResultDTO result, WebElement firstResultsDiv) {
|
|
|
- List<WebElement> oddsDivs = firstResultsDiv.findElements(By.xpath("./div/div"));
|
|
|
|
|
|
|
+ List<WebElement> oddsDivs = firstResultsDiv.findElements(By.xpath("./div"));
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- result.setOdds1(Float.parseFloat(oddsDivs.get(0).getText()));
|
|
|
|
|
- result.setOddsX(Float.parseFloat(oddsDivs.get(1).getText()));
|
|
|
|
|
- result.setOdds2(Float.parseFloat(oddsDivs.get(2).getText()));
|
|
|
|
|
|
|
+// result.setOdds1(Float.parseFloat(oddsDivs.get(0).getText()));
|
|
|
|
|
+// result.setOddsX(Float.parseFloat(oddsDivs.get(1).getText()));
|
|
|
|
|
+// result.setOdds2(Float.parseFloat(oddsDivs.get(2).getText()));
|
|
|
|
|
+
|
|
|
|
|
+ result.setOdds1(Float.parseFloat(oddsDivs.get(1).getText()));
|
|
|
|
|
+ result.setOddsX(Float.parseFloat(oddsDivs.get(2).getText()));
|
|
|
|
|
+ result.setOdds2(Float.parseFloat(oddsDivs.get(3).getText()));
|
|
|
} catch (NumberFormatException e) {
|
|
} catch (NumberFormatException e) {
|
|
|
// Skip this one
|
|
// Skip this one
|
|
|
} catch (IndexOutOfBoundsException e) {
|
|
} catch (IndexOutOfBoundsException e) {
|
|
@@ -269,8 +278,11 @@ public class OddsPortal extends ParserBase implements ParserJoinedFunctions {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void setScoring(ResultDTO result, WebElement firstResultsDiv) {
|
|
private void setScoring(ResultDTO result, WebElement firstResultsDiv) {
|
|
|
- if (checkIfElementExists(firstResultsDiv, "./div/a/div[2]/div/div/div/div/div")) {
|
|
|
|
|
- List<WebElement> scoringDivs = firstResultsDiv.findElements(By.xpath("./div/a/div[2]/div/div/div/div/div"));
|
|
|
|
|
|
|
+// String resultPath = "./div/a/div[2]/div/div/div/div/div";
|
|
|
|
|
+ String resultPath = "./div/div[2]/div/div/div/div/div";
|
|
|
|
|
+
|
|
|
|
|
+ if (checkIfElementExists(firstResultsDiv, resultPath)) {
|
|
|
|
|
+ List<WebElement> scoringDivs = firstResultsDiv.findElements(By.xpath(resultPath));
|
|
|
try {
|
|
try {
|
|
|
result.setHomeScore(Integer.parseInt(scoringDivs.get(0).getText()));
|
|
result.setHomeScore(Integer.parseInt(scoringDivs.get(0).getText()));
|
|
|
result.setAwayScore(Integer.parseInt(scoringDivs.get(2).getText()));
|
|
result.setAwayScore(Integer.parseInt(scoringDivs.get(2).getText()));
|
|
@@ -282,9 +294,10 @@ public class OddsPortal extends ParserBase implements ParserJoinedFunctions {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void setTeamsInfo(ResultDTO result, WebElement firstResultsDiv) {
|
|
private void setTeamsInfo(ResultDTO result, WebElement firstResultsDiv) {
|
|
|
- List<WebElement> teams = firstResultsDiv.findElements(By.xpath(".//div//a//div[2]//a"));
|
|
|
|
|
- String homeTeamName = teams.get(0).getText().trim();
|
|
|
|
|
- String awayTeamName = teams.get(1).getText().trim();
|
|
|
|
|
|
|
+ //List<WebElement> teams = firstResultsDiv.findElements(By.xpath(".//div//a//div[2]//a"));
|
|
|
|
|
+ List<WebElement> teams = firstResultsDiv.findElements(By.xpath(".//a"));
|
|
|
|
|
+ String homeTeamName = teams.get(0).findElement(By.xpath("/div[1]")).getText().trim();
|
|
|
|
|
+ String awayTeamName = teams.get(1).findElement(By.xpath("/div[1]")).getText().trim();
|
|
|
result.setHomeTeam(homeTeamName);
|
|
result.setHomeTeam(homeTeamName);
|
|
|
result.setAwayTeam(awayTeamName);
|
|
result.setAwayTeam(awayTeamName);
|
|
|
|
|
|