0

I have a selenium web scraping project and there is a button I have to click it 1600 times but after 1000 clicks chrome doesn't load the page any more (it just showing the loading sign but does not load the page ) Does selenium have maximum number of clicks ?

If yes, how I could change this maximum number to be larger

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • Not sure that there is an limit, maybe your doing it to fast (without delay) - Please, provide some code, that would help to understand, what you are doing exactly. – HedgeHog Nov 26 '20 at 10:53
  • Does the click trigger a request/action? It might be wise to wait until that action is finished before clicking again. – AZWN Nov 26 '20 at 10:54
  • It's not selenium issue it's the webpage issue – PDHide Nov 26 '20 at 12:00

1 Answers1

0

Selenium itself doesn't contain any click but contains a method which you can invoke to simulate a click on a clickable element.

The click() mehtod is defined as:

def click(self):
    """Clicks the element."""
    self._execute(Command.CLICK_ELEMENT)

You can invoke the click() mehtod on any clickable element as many as possible times you can.


Ideally, to click on the element you need to induce WebDriverWait for the element_to_be_clickable() and you can use either of the following Locator Strategies:

  • Using LINK_TEXT:

    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.LINK_TEXT, "Click Link"))).click()
    
  • Using PARTIAL_LINK_TEXT:

    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.PARTIAL_LINK_TEXT, "Click Partial Link"))).click()
    
  • Note: You have to add the following imports :

    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.common.by import By
    from selenium.webdriver.support import expected_conditions as EC
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • I do the wait before but also after 1000 clicks chrome does not load the page any more so is there maximum html content that chrome Webdriver allows ? – Ali Nasser Nov 27 '20 at 06:10