Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

automated tests - How to automate acrobat reader popup in browser? (Using javascript, nodejs, codeceptjs in the project)

I need to automate click of the OK button (OR press enter key) in the acrobat reader popup which appears in browser after clicking on the button to open pdf file. So it gives you options to open in browser, open in acrobat reader or download. I need to open it in browser and make a screenshot, then switch to parent window (since it opens PDF file in other window).

The problem here is that popup is not part of the web app (not in the DOM), and you can not inspect the element. How do you handle those popups? Please help! Unfortunately I can not attach screenshot of the popup, since its my first question here

////////////////////////////////////////////////// //this is the function which clicks on the button before the popup appears

async viewEligibilityPdf() {
    console.log('******************* ELIGIBILITY RESULTS PAGE ***********');
    await I.waitForText('Eligibility results', 120);

    await I.wait(5);

    await I.waitForEnabled(this.buttons.viewEligibility, 120);
    await I.saveScreenshot(`EligibilityResultsPage.png`);
    await I.click(this.buttons.viewEligibility);

}

question from:https://stackoverflow.com/questions/65893011/how-to-automate-acrobat-reader-popup-in-browser-using-javascript-nodejs-code

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The chances are you probably can't. Web browsers have pretty strict security measures that prevent automation especially outside of your own code.

I know that you're unable to post a screenshot, but more information would be helpful.

  • Are you (is your application) generating this PDF?
  • Also, please provide at least a sample of the piece of code where you're opening this PDF.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...