0

I'm trying click on button which has attribute:

href = javascript:window.print()

So, when I'm trying click on it there is a page with preview data for print (as I understood the 'javascript:window.print()' causes print window)

as i understood 'click()' of IWebElement (OpenQA.Selenium) waiting for page to load or something else and then automation test shut down with

http request timed out webdriver exception

. enter image description here

I'm tryed use click of OpenQA.Selenium.Interactions// IwebElement Click()// and javascript click () there are same result with http request timed out error

element attribute: <button class='className' href = 'javascript:window.print()' /button>

And I tryed:

element = driver.findElement(By.Class('className'));

(1) first case:

element.Click(); // as IWebDriver standart method

(2) second case:

 Actions action = new Actions(driver);
    action.MoveToElement(element).Click().Perform();

and third case: (3)

Browser.ExecuteJavaScript("(document.getElementByClassName('className'))[0].click();")
4
  • Can you post all relevant code please Commented May 31, 2018 at 12:37
  • done. I added everything I did
    – Kate
    Commented May 31, 2018 at 12:48
  • Post the HTML of the button. What happens when you click the button? Does the print dialog launch or ? What are you trying to test in the print dialog? It's going to be browser specific and you aren't going to be able to interact with it using Selenium. You might just test that the button has the right href and call the test good.
    – JeffC
    Commented May 31, 2018 at 13:12
  • 't test that the button has the right href and call the test good' - But what if I click on button and nothing happens after it? When I click on button the print preview opened and shown on top of the page. But click is not interrupted and continue waiting something - I don't know what... I must to check that preview's page content loaded. And If I switch to another tab I can check content of the page
    – Kate
    Commented May 31, 2018 at 13:44

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.