Ctrl + p combination in selenium

910 views
Skip to first unread message

Imran Khan

unread,
May 25, 2019, 2:50:00 PM5/25/19
to seleniu...@googlegroups.com
Dear all,

I am trying to pass "CTRL + P" combination. But, it doesn't work. PFB the statement which i have used,

driver.findElement(By.xpath("//body")).sendKeys(Keys.chord(Keys.CONTROL, "p"));

Do we have any alternate option for this?.

Could you please help me out with this?

Thanks,
Imran.

John Doe

unread,
May 26, 2019, 2:08:36 AM5/26/19
to Selenium Users
You're looking into wrong direction as:

  1. You should not be testing print dialog as it is a part of browser functionality and not related to your application
  2. If you're really testing the browser, not the web application you should be aware that sticking to key events is not the best option to proceed as if/when you come to the situation of tests execution in Selenium Grid or other way of Parallel Tests Execution - you will run into unpleasant race condition. So you can go for i.e. Window.print() function instead
driver.executeAsyncScript("window.print();");



Imran Khan

unread,
May 26, 2019, 3:30:11 AM5/26/19
to seleniu...@googlegroups.com
Dear John,

I am working for a banking application. The test case says 
1. User should click on "Print" icon and it should open "Print" window with "Print" anc "Cancel" buttons.
2. "Cancel" button should navigate back to the previous page.

Hence, i should validate these two functionalities. Clients're not ready for third party tools like "AutoIT" (or) "Sikulli". If you have any technical solution, then i request you to provide this.

Thanks,
Imran.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/a41a22ee-acdc-4bcd-af51-19545c5aafb7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages