UndetectedChromedriver icon indicating copy to clipboard operation
UndetectedChromedriver copied to clipboard

popap windows

Open operlay opened this issue 6 months ago • 0 comments

Every time I do activity on the page, pop-up windows constantly appear.``

package org.example;

import com.frogking.chromedriver.ChromeDriverBuilder;
import org.brit.driver.PlaywrightiumDriver;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeDriverService;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.logging.HasLogEvents;

import java.io.File;

import java.net.URI;
import java.security.cert.X509Certificate;
import java.util.Base64;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import javax.net.ssl.*;

import static org.openqa.selenium.devtools.events.CdpEventTypes.consoleEvent;


//https://github.com/ultrafunkamsterdam/undetected-chromedriver
public class Main {


    public static void main(String[] args) throws InterruptedException {
            System.out.printf("..start..");


            String driver_home = "C:\\Users\\user\\IdeaProjects\\testCF34\\driver\\128.0.6613.114\\32\\chromedriver.exe";
            ChromeOptions chrome_optionsHAK = new ChromeOptions();
            chrome_optionsHAK.addArguments("--window-size=1920,1080");
            chrome_optionsHAK.setExperimentalOption("useAutomationExtension", false);
             chrome_optionsHAK.setExperimentalOption("excludeSwitches",Collections.singletonList("enable-automation"));

        ChromeOptions chrome_options = new ChromeOptions();
        chrome_options.addArguments("--window-size=1920,1080");
        //chrome_options.wait(4000);
        //chrome_options.setExperimentalOption("excludeSwitches",Collections.singletonList("enable-automation"));

        ChromeDriver chromeDriver =   new ChromeDriverBuilder().build(chrome_options,driver_home);
        Map<String, Object> commandConsoleList = new HashMap<>();

        commandConsoleList.put("delete", "window.cdc_adoQpoasnfa76pfcZLmcfl_JSON");
        commandConsoleList.put("delete", "window.cdc_adoQpoasnfa76pfcZLmcfl_Object");
        commandConsoleList.put("delete", "window.cdc_adoQpoasnfa76pfcZLmcfl_Proxy");



        try {
            // Navigate to Url
           // chromeDriver.executeCdpCommand("source",commandConsoleList);

            chromeDriver.get("https://nnmclub.to/forum/index.php");
            Thread.sleep(2000);
            WebElement element =  chromeDriver.findElement(By.xpath("/html/body/div[1]/table/tbody/tr[2]/td/table/tbody/tr/td/table[2]/tbody/tr/td[1]/table/tbody/tr[2]/td/table/tbody/tr[5]/td[2]/a[2]"));
            String text = element.getText();                                                                        ////*[@id="forum_14_918"]/td[2]/h3/a
            System.out.println("text: "+ text);
            element.click();
            Thread.sleep(4000);

        } finally {
            //chromeDriver.close();
           // Thread.sleep(4000);
          //  chromeDriver.quit();
        }




        System.out.println("..finish..");
    }

```}

operlay avatar Sep 01 '24 03:09 operlay