How to open a local pdf file through chrome driver?

Viewed 42

Is there a way to open a local pdf file using chrome driver? I have tried this

driver().switchTo().window("file://C:\Users\ashok\Downloads\fileToRead.pdf")

which is not working for me. Please help. Thanks

1 Answers

Local files can be opened with simple driver.get().
Also the slashes should be corrected.
Try this:

driver().get("C://Users/ashok/Downloads/fileToRead.pdf")
Related