Add glossary methods #4

Open
KaKi87 wants to merge 15 commits from Androz2091/deepl-scraper:glossary-v2 into master
Showing only changes of commit 171cafb5e0 - Show all commits

View file

@ -110,18 +110,19 @@ module.exports = {
await page.click(glossaryButton);
await page.waitForSelector(langSelect, { visible: true });
await page.click(langSelect);
try {
{
let isSet = false;
for(const button of await page.$$('button[dl-test=glossary-newentry-lang-dropdown-option]')){
const
_sourceLanguage = await (await (await button.$('.langCode')).getProperty('textContent')).jsonValue(),
_targetLanguage = await (await (await button.$('.langCode:nth-of-type(2)')).getProperty('textContent')).jsonValue();
if(sourceLanguage === _sourceLanguage && targetLanguage === _targetLanguage){
await button.click();
isSet = true;
break;
}
}
}
catch(_){
if(!isSet)
throw new Error('UNSUPPORTED_GLOSSARY_LANGUAGE');
}
await page.waitForSelector(sourceGlossaryInput, { visible: true });