Yanfeng Li
Yanfeng Li

Reputation: 79

Can I minimize chrome window while selenium is running?

I have a project to get some information from website. I want to look at the process inside the chrome window, So I can't use headless browser. But sometimes I want to minimize the chrome window.

But I found the selenium would go wrong after I minimize the chrome window manually, but sometimes not. When go wrong, exception

element is not clickable at the point, other element will receive the click

will be raised, or sometimes selenium just stop.

I have searched for a long time that some people said that the chrome window should be focused on and can't be minimized by clicking '-' on the window title bar. And the alternative solution is:

web.set_window_position(-2000,-2000)

To make the window move out the screen.

And someone says by simulating shortcuts to minimize the window. But I think it's the same as click '-' manually, am I wrong?

My question is :

I am really sorry for my poor English. I hope I have a clear description of my problem.

Environment:

Edit to add code:

wait.WebDriverWait(driver,100000).until(EC.visibility_of_element_located((By.ID,'commMgrCompositionMessage')))
        textArea = driver.find_element_by_id('commMgrCompositionMessage')
        driver.execute_script("arguments[0].value="+"'"+modelStr+"';",textArea)
        time.sleep(1)
        wait.WebDriverWait(driver,10000).until(EC.presence_of_all_elements_located((By.CSS_SELECTOR,'#sendemail_label')))
        allSendMailLabel = driver.find_elements_by_css_selector('#sendemail')
        allSendMailLabel = allSendMailLabel[1]
        driver.execute_script("arguments[0].click();", allSendMailLabel)

Upvotes: 5

Views: 3493

Answers (1)

rassa45
rassa45

Reputation: 3550

If you see the question here Debugging "Element is not clickable at point" error, there is a bug in the chromedriver that causes this. The issue for it was created here. There is a workaround listed in the 27th comment, but what you can do is switch to the firefox driver and see if that works. Minimised windows should not cause a problem otherwise.

Upvotes: 2

Related Questions