5

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 :

  • Does selenium really requires chrome window not minimized? Why sometimes it can run selenium normally after minimized but sometimes not?
  • If I use

    set_window_position(-2000,-2000)

    to move the window invisible, then I click the window icon on the bottom of os (I'm sorry that I don't know what it's called). Normally when clicked, the window will be minimized. So as for this chrome window, Will it be considered as minimized window and go wrong?

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

Environment:

  • python 3.6
  • chrome 66.0
  • selenium 3.11.0
  • windows server 2012

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)
Yanfeng Li
  • 79
  • 1
  • 4
  • are you explicitly moving to the part of the page that has the element or closing any elements that may be blocking it before you get the Element not clickable error? you should definitely be able to run Selenium w/ Chrome with the Chrome window minimized - I do it all the time. – n1c9 May 23 '18 at 17:50
  • I am sure the page is correct and no other elements block it, because I have run it for 2 hours, but when i minimized the window, and then after about 2 minnutes, it went wrong. – Yanfeng Li May 23 '18 at 18:12

1 Answers1

2

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.

rassa45
  • 3,482
  • 1
  • 29
  • 43
  • When I minimize the window, the error will occurs:Display::DrawAndSwap, LatencyInfo vector size 102 is too big. But when I maximize it, the error won't occur. Could you tell me how to fix it? Thanks for your answer! – Yanfeng Li May 24 '18 at 09:04
  • I have post my code on the question. And the code can run with minimized in my local desktop, but failed on remote windows server 2012. Thanks for advance! – Yanfeng Li May 25 '18 at 01:55
  • OK, there are so many things you need to check yourself man. Are you admin of this remote machine, does it have a different version of chromedriver that has the bug I stated in my answer? We can't give you a solution out of thin air. – rassa45 May 25 '18 at 02:28
  • Also, I just noticed, you asked this question earlier and it was closed for being a duplicate. I hope you understand you broke StackOverflow rules for asking the same question again. – rassa45 May 25 '18 at 02:30
  • I'm really sorry for that. I'm new to StackOverflow and selenium and I think they are two different questions, maybe one for blocked element and another for window's redraw. But they all occur after minimized. I have explained my opinion to admin.Maybe I'm wrong and duplicate, but I don't mean to do so. Thanks for your patience and help anyway, I will check some info about the windows. – Yanfeng Li May 25 '18 at 15:39