Похожие чаты

Good afternoon, colleagues🖐 I have the following question. I'm debugging my

own project. I have two separated classes, which use two separated threads in Main class.

While going through debug of the class, which running one of 2 websites, I open the website another one.

So, my situation is the next. Here's one of 2 classes:

public class GBFeedReader implements Runnable {

//private static ChromeOptions chOptions;
private DatabaseConnections databaseConnections = new DatabaseConnections();

public void run() {

// Setup ChromeDriver using WebDriverManager
WebDriverManager.chromedriver().setup();

// Set Chrome options and capabilities
ChromeOptions chromeOptions = new ChromeOptions();
//WebDriverManager.chromedriver().browserVersion("119.0.6045.160").setup();
//WebDriverManager.chromedriver().capabilities(chOptions).setup();
//WebDriverManager.chromedriver().capabilities(chromeOptions).setup();

chromeOptions.addArguments("--headless");
chromeOptions.addArguments("--disable-gpu");
chromeOptions.addArguments("--disable-extensions");

ChromeDriver driver = new ChromeDriver(chromeOptions);
driver.get("https://....");
...

and the 2-nd one as below:

public class BGFeedReader implements Runnable {
private DatabaseConnections databaseConnections = new DatabaseConnections();

public void run() {
ChromeOptions options = new ChromeOptions();
//WebDriverManager.chromedriver().browserVersion("118.0.5993.118").setup();
//WebDriverManager.chromedriver().browserVersion("114.0.5735.90").setup();
//WebDriverManager.chromedriver().setup();
/*options.addArguments("--headless");
options.addArguments("--disable-gpu");
options.addArguments("--disable-extensions");*/

ChromeDriver driver = new ChromeDriver(options);
driver.get("https://www.banggood.com/new-arrivals.html");
//driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(30));

...

I'm binding them as below:

public static void main(String[] args) {
//PropertyConfigurator.configure("D:\\IdeaProject\\maven-bot\\src\\main\\resources\\log4j.properties");
// creation pool with 2 threads
//A ScheduledExecutorService is capable of scheduling
// tasks to run either periodically or once after a certain amount of time has elapsed.
ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(2);

long initialDelay = 0; // the time from now to delay execution - первоначальная задержка
long period = 1; // the period between successive executions - повторение ежедневное
scheduler.scheduleAtFixedRate(new GBFeedReader(), initialDelay, period, TimeUnit.DAYS);
sleepThread();
scheduler.scheduleAtFixedRate(new BGFeedReader(), initialDelay, period, TimeUnit.DAYS);
ApiContextInitializer.init();

// ...
}

As result, the code is running instead of the class GBFeedReader, the class BGFeedReader

The question, am I missing something here? My configuration of the running debug the next one (screen)

Thanks in advance for any ideas, if you're included in my topic, because I'm still confusing with it. Maybe, I'm missing multithreading some detailes under the hood.

5 ответов

52 просмотра
Nan0- Автор вопроса
Nan0- Автор вопроса

If I find the way how to fix it, I'll update the question here👍

Nan0- Автор вопроса

Under the phrase as: "As result, the code is running instead of the class GBFeedReader, the class BGFeedReader" I mean it opens me the website of the another class absolutely, for some reason.

Nan0- Автор вопроса
Nan0
Under the phrase as: "As result, the code is runn...

In short, from the last updates. I have a different result on the different versions of Selenium. For example, if you take versions from 3.x.x, then the wrong site opens when using several threads, but if you take from 4.x.x, it generally ignores and does not open anything, no browsers. My first conclusion is that this is related to versioning, but how to get around it, this is tough a question, as for now.

Nan0- Автор вопроса
Nan0
In short, from the last updates. I have a differen...

The cause was in these lines: chromeOptions.addArguments("--headless"); chromeOptions.addArguments("--disable-gpu"); chromeOptions.addArguments("--disable-extensions"); I simply forgot I didn't comment these lines in Gearbest class, but I commented it in BGFeedReader

Похожие вопросы

Обсуждают сегодня

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Rꙮman Yankꙮvsky
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Viktor G.
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Živa Žena
20
This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
🍿 °anton°
2
30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Ben
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Vitaly
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Justfrontin 👀
11
Карта сайта