Jelajahi Sumber

Fix for selecting Odds after page change

Axel Nordh 11 bulan lalu
induk
melakukan
97110bc936
1 mengubah file dengan 3 tambahan dan 4 penghapusan
  1. 3 4
      Odds/src/parser/OddsPortal.java

+ 3 - 4
Odds/src/parser/OddsPortal.java

@@ -132,13 +132,12 @@ public class OddsPortal extends ParserBase implements ParserJoinedFunctions {
         wait.until(ExpectedConditions.numberOfElementsToBeMoreThan(By.xpath(DIV_CONTAINS_CLASS_TABS_DIV_NOT_CLASS_DIV_1_DIV), 1));
 
         System.out.println("Switching odds");
-        if (!checkIfElementExists(driver, "//p[text()='Decimal Odds']")) {
-            WebElement oddsFormat = driver.findElement(By.xpath("//p[@class='self-center text-xs " +
-                    "text-orange-main'][1]"));
+        if (!checkIfElementExists(driver, "//p[contains(@class, 'text-orange-main')]")) {
+            WebElement oddsFormat = driver.findElement(By.xpath("//p[contains(@class, 'text-orange-main')]"));
 
             oddsFormat.click();
 
-            driver.findElement(By.xpath("//a[text()='Decimal Odds']")).click();
+            driver.findElement(By.xpath("//a[span[contains(text(),'Decimal Odds')]]")).click();
             wait.withTimeout(Duration.ofSeconds(30));
         }