ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("excludeSwitches",
Arrays.asList("disable-popup-blocking"));
self.options.add_experimental_option('excludeSwitches', ['disable-popup-blocking'])
run on: Mon Jan 02 2023 21:6:2
Wikipedia page for :de
text: Willkommen bei Wikipedia
run on: Mon Jan 02 2023 21:6:2
Wikipedia page for :ru
text: Добро пожаловать в Википедию,
run on: Mon Jan 02 2023 21:6:3
Wikipedia page for :fr
text: Wikipédia
rows = ['de', 'fr', 'ru'];
rows.forEach(async function(el) {
await hello(el);
await sleep(5000);
});
function sleep(ms) {
return new Promise((o) => { setTimeout(o, ms); });
}
async function hello(el) {
let driver;
try {
let builder = new Builder().forBrowser('chrome');
let options = new Options();
options.headless();
options.excludeSwitches(['enable-logging']);
options.addArguments(['--no-sandbox']);
driver = await builder.setChromeOptions(options).build();
await driver.get('https://www.wikipedia.org/');
await driver.findElement(By.xpath('//*[@id="js-link-box-' + el + '"]')).click();
const t = await driver.findElement(By.xpath('//*[@class="mw-headline"]')).getText();
let d = new Date(Date.now());
console.log('run on: ' +
d.toDateString() + ' ' + d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds());
console.log('Wikipedia page for :' + el);
console.log(`text: ${t}`);
await sleep(1000);
} catch (e) {
console.log(e);
} finally {
if (driver) {
await driver.close();
await driver.quit();
}
}
}
await indexOne();
tar tvf a.tar | grep -E '/\bd | ...
- то есть вместо пробела поставить разделитель пути \b
пробелtar tvf a.tar | grep -E ' \bd' | awk '{print $NF}' | xargs -IX tar xvf a.tar X
tar tvf a.tar
-rw-rw-r-- sergueik/sergueik 0 2022-12-29 05:24 do-10.txt
-rw-rw-r-- sergueik/sergueik 0 2022-12-29 05:24 do-1.txt
-rw-rw-r-- sergueik/sergueik 0 2022-12-29 05:24 do-2.txt
-rw-rw-r-- sergueik/sergueik 0 2022-12-29 05:24 do-3.txt
-rw-rw-r-- sergueik/sergueik 0 2022-12-29 05:24 do-4.txt
-rw-rw-r-- sergueik/sergueik 0 2022-12-29 05:24 do-5.txt
-rw-rw-r-- sergueik/sergueik 0 2022-12-29 05:24 do-6.txt
-rw-rw-r-- sergueik/sergueik 0 2022-12-29 05:24 do-7.txt
-rw-rw-r-- sergueik/sergueik 0 2022-12-29 05:24 do-8.txt
-rw-rw-r-- sergueik/sergueik 0 2022-12-29 05:24 do-9.txt
-rw-rw-r-- sergueik/sergueik 0 2022-12-29 05:24 to-10.txt
-rw-rw-r-- sergueik/sergueik 0 2022-12-29 05:24 to-1.txt
-rw-rw-r-- sergueik/sergueik 0 2022-12-29 05:24 to-2.txt
-rw-rw-r-- sergueik/sergueik 0 2022-12-29 05:24 to-3.txt
-rw-rw-r-- sergueik/sergueik 0 2022-12-29 05:24 to-4.txt
-rw-rw-r-- sergueik/sergueik 0 2022-12-29 05:24 to-5.txt
-rw-rw-r-- sergueik/sergueik 0 2022-12-29 05:24 to-6.txt
-rw-rw-r-- sergueik/sergueik 0 2022-12-29 05:24 to-7.txt
-rw-rw-r-- sergueik/sergueik 0 2022-12-29 05:24 to-8.txt
-rw-rw-r-- sergueik/sergueik 0 2022-12-29 05:24 to-9.txt
tar tvf a.tar | grep -E ' \bd' | awk '{print $NF}' | xargs -IX tar xvf a.tar X
d*
:do-10.txt
do-1.txt
do-2.txt
do-3.txt
do-4.txt
do-5.txt
do-6.txt
do-7.txt
do-8.txt
do-9.txt