-4

I'm running the selenium browser(google chrome) on python virtual display. Some times some elements not clickable.

from pyvirtualdisplay import Display
from selenium import webdriver
import time

display = Display(visible=0, size=(1000, 900))
display.start()
browser = 
webdriver.Chrome(executable_path="/usr/local/bin/chromedriver")
browser.set_window_size(1500, 1000)
browser.get("http://www.some-site.com/page/")
time.sleep(30)
browser.find_element_by_xpath("some-x-path").click()

error : selenium.WebDriverException: Element is not clickable

waruna k
  • 842
  • 10
  • 20
  • 3
    Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. – cruisepandey May 02 '19 at 06:15
  • How is _correct size of python virtual display and browser_ related to `selenium`? – undetected Selenium May 02 '19 at 06:35
  • sometimes you have to wait/sleep till browse renders page or JavaScript makes clickable items. Or you have to scroll to make button visible in window. or you have to remove popup window which hides button. – furas May 02 '19 at 06:40
  • @DebanjanB i am using selenium web driver (google chrome) and python virtual display. – waruna k May 02 '19 at 07:13
  • @furas did you seen time.sleep(30). – waruna k Jun 11 '19 at 06:11
  • did you run it without virtualdisplay to see element which you want to click ? Better always add url to page so we could see it and check it. Sometimes element is hidden behind popup or other element or you have to scroll content to see element in window before you can click it. [Debugging “Element is not clickable at point” error](https://stackoverflow.com/questions/11908249/debugging-element-is-not-clickable-at-point-error) – furas Jun 13 '19 at 00:31

1 Answers1

0

I found the solution for this problam.

My virtual display size is "(1000, 900)" and my browser window size is "(1200, 1100)". My browser window size is max than virtual display size.I change the display size to (1500, 1200). Now it's work fine.

  • Please remind set your browser window size less than virtual display size.

  • Another way you can use browser with full size. "driver.maximize_window()"

    from pyvirtualdisplay import Display from selenium import webdriver

    display = Display(visible=0, size=(1500, 1200)) display.start() browser = webdriver.Chrome(executable_path="/usr/local/bin/chromedriver") browser.set_window_size(1200, 1100) browser.get("http://www.some-site.com/page/") browser.find_element_by_xpath("some-x-path").click()

waruna k
  • 842
  • 10
  • 20