Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

popap windows #11

Open
operlay opened this issue Sep 1, 2024 · 0 comments
Open

popap windows #11

operlay opened this issue Sep 1, 2024 · 0 comments

Comments

@operlay
Copy link

operlay commented Sep 1, 2024

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..");
    }

```}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant