Chrome Print Dialog Number of Copies and Click Print Button (Selenium) Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
chngrcn
Posts: 190
Joined: 29 Feb 2016, 08:55

Chrome Print Dialog Number of Copies and Click Print Button (Selenium)

21 Sep 2018, 07:12

Code: Select all


;button html code

<div class="button-strip" reversed="">
  <button class="print default">Print</button>
    <button class="cancel">Cancel</button>
</div>

;copies number box html code

<div class="settings-box" id="copies-settings-box">
      <input class="user-value" type="number" value="1" maxlength="3" max="999" min="1" aria-labelledby="copies-label" id="copies">
      <div class="collate-container checkbox" aria-live="polite" hidden=""><label>
        <input class="collate" type="checkbox" checked="" aria-labelledby="copies-collate-label">
        <span id="copies-collate-label">Harmanla</span>
      </label></div>
</div>
I am using selenium. I need your help.
When we enter the print menu in chrome, in the html codes given above,
I want java code running in selenium.

print "2" in the number of copies box and
I want to click on the "Print" button.

How to write codes?
Thank you.
chngrcn
Posts: 190
Joined: 29 Feb 2016, 08:55

Re: Chrome Print Dialog Number of Copies and Click Print Button (Selenium)

22 Sep 2018, 14:39

After doing ctrl + p in chrome, I want to send the number 2 to the copies box. And I want to push the print button.
I would like your help.
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: Chrome Print Dialog Number of Copies and Click Print Button (Selenium)  Topic is solved

24 Sep 2018, 01:49

You cant interact with that print method using selenium.

But you can use Ctrl Shift P and bring up the OS dialog box which you can interact with directly.

Example:

Code: Select all

driver := ComObjCreate("Selenium.ChromeDriver") 
driver.Get("https://autohotkey.com/boards/viewtopic.php?f=5&t=56084")

Send, ^+p

WinWait, Print ahk_class #32770
ControlSetText, Edit5, 2, Print ahk_class #32770
ControlClick, Button13, Print ahk_class #32770
HTH
chngrcn
Posts: 190
Joined: 29 Feb 2016, 08:55

Re: Chrome Print Dialog Number of Copies and Click Print Button (Selenium)

24 Sep 2018, 02:18

I don't want it that way. After doing ctrl + p, the number of prints in the PDF viewer will be 2 and click the print button.
In the attached image, in the "copies" box on the screen that will appear, you will type 2, and click the "print" button.
Attachments
Adsız.jpg
(286.69 KiB) Not downloaded yet
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: Chrome Print Dialog Number of Copies and Click Print Button (Selenium)

24 Sep 2018, 05:02

Do a search for print dialog using selenium in google or your fav search engine.
You will find out what it doesnt work with selenium.

BTW what i posted does the same exact thing.
Did you even try it?

GL

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Frogrammer, gongnl and 275 guests