Subversion Repositories SmartDukaan

Rev

Rev 37431 | Rev 37433 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 37431 Rev 37432
Line 100... Line 100...
100
                    try {
100
                    try {
101
                        LOGGER.info("Starting fresh with new IMEI " + imei);
101
                        LOGGER.info("Starting fresh with new IMEI " + imei);
102
                        if (driver.findElement(By.className("el-input__inner")).getAttribute("value").length() > 0) {
102
                        if (driver.findElement(By.className("el-input__inner")).getAttribute("value").length() > 0) {
103
                            LOGGER.info("Darn.. leaving" + driver.findElement(By.className("el-input__inner")).getAttribute("value"));
103
                            LOGGER.info("Darn.. leaving" + driver.findElement(By.className("el-input__inner")).getAttribute("value"));
104
                            driver.get("https://support.oppo.com/in/warranty-check/");
104
                            driver.get("https://support.oppo.com/in/warranty-check/");
-
 
105
                            installResponseCapture(driver);
105
                            break;
106
                            break;
106
                        }
107
                        }
107
                        driver.findElement(By.className("el-input__inner")).sendKeys(imei);
108
                        driver.findElement(By.className("el-input__inner")).sendKeys(imei);
108
 
109
 
109
                        //driver.findElement(By.className("el-button--primary")).click();
110
                        //driver.findElement(By.className("el-button--primary")).click();
Line 130... Line 131...
130
                                //Thread.sleep(5000);
131
                                //Thread.sleep(5000);
131
                            } catch (Exception e) {
132
                            } catch (Exception e) {
132
                                LOGGER.warn("Slider captcha widget (dx_captcha_basic_*) not found or not draggable"
133
                                LOGGER.warn("Slider captcha widget (dx_captcha_basic_*) not found or not draggable"
133
                                        + " - reloading. Cause: " + e.getMessage());
134
                                        + " - reloading. Cause: " + e.getMessage());
134
                                driver.get("https://support.oppo.com/in/warranty-check/");
135
                                driver.get("https://support.oppo.com/in/warranty-check/");
-
 
136
                                installResponseCapture(driver);
135
                                break;
137
                                break;
136
                            }
138
                            }
137
                            double[] circles = getMatCircles2(driver, fileName);
139
                            double[] circles = getMatCircles2(driver, fileName);
138
                            if (circles != null) {
140
                            if (circles != null) {
139
                                double firstCircleX = circles[0];
141
                                double firstCircleX = circles[0];
Line 203... Line 205...
203
                        LOGGER.warn("Counter reached upto 20");
205
                        LOGGER.warn("Counter reached upto 20");
204
                    } catch (Exception e) {
206
                    } catch (Exception e) {
205
                        LOGGER.error("Oppo warranty check failed for imei " + imei, e);
207
                        LOGGER.error("Oppo warranty check failed for imei " + imei, e);
206
                    }
208
                    }
207
                    driver.get("https://support.oppo.com/in/warranty-check/");
209
                    driver.get("https://support.oppo.com/in/warranty-check/");
-
 
210
                    // Every navigation destroys the JS context, taking the capture hook
-
 
211
                    // with it. Miss one of these and the page is blind from the second
-
 
212
                    // imei onwards: __oppoResp and __oppoCaptcha both come back null,
-
 
213
                    // which reads as "the captcha failed" when it may well have passed.
-
 
214
                    installResponseCapture(driver);
208
                }
215
                }
209
                mainCount++;
216
                mainCount++;
210
                remainingImeis = imeis.stream().filter(x -> !dateMap.containsKey(x)).collect(Collectors.toList());
217
                remainingImeis = imeis.stream().filter(x -> !dateMap.containsKey(x)).collect(Collectors.toList());
211
                if (remainingImeis.isEmpty()) break;
218
                if (remainingImeis.isEmpty()) break;
212
            } while (mainCount < 5);
219
            } while (mainCount < 5);