0

I am trying to iterate over pages having a program List and then I have to select checkbox defined in an image below in order to get the run length of a loop on-page.

But when I am trying to navigate over pages via the next button it will stop clicking on checkboxes and throws me below error.

I have tried with xpath,css selector and id method But all get failed.

DOM element SS along with checkbox highlighted

Line of Code Used-

CheckBoxclick = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "#workflow_table > thead > tr > th.first.checkbox-column.checkbox > input"))).click()

Error:-

   File "D:/Vipul Garg Backup/XXXX/TestingPardotExportProgramsData.py", line 74, in <module>
    ProgramsPathlist = getDataForPrograms(RecordsonOnePage,totalnofpages)
  File "D:/Vipul Garg Backup/XXXX/TestingPardotExportProgramsData.py", line 63, in getDataForPrograms
    RecordsonOnePage = getrecordsoNpage()
  File "D:/Vipul Garg Backup/XXXX/TestingPardotExportProgramsData.py", line 42, in getrecordsoNpage
    CheckBoxclick = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "#workflow_table > thead > tr > th.first.checkbox-column.checkbox > input"))).click()
  File "C:\Users\Vipul.Garg\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\webelement.py", line 80, in click
    self._execute(Command.CLICK_ELEMENT)
  File "C:\Users\Vipul.Garg\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\webelement.py", line 633, in _execute
    return self._parent.execute(command, params)
  File "C:\Users\Vipul.Garg\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "C:\Users\Vipul.Garg\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document
  (Session info: chrome=80.0.3987.122)

But Above Line of Code is Working Intermetantly and throwing error as above.
Any suggestions for this line of code replacement as why I am getting such inconsistency.

4
  • Please edit your question and add the HTML. Commented Mar 3, 2020 at 17:02
  • Does this discussion helps you? Commented Mar 3, 2020 at 23:05
  • @debanjan B I have gone through a mentioned discussion and I have tried to implement the same but getting error-->raise MaxRetryError(_pool, url, error or ResponseError(cause))urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=58203): Max retries exceeded with url: /session/55249a6d074546bf325b41dd87f5d62e/url (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000002DB8C63BBC8>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it')) Commented Mar 4, 2020 at 3:07
  • @DebanjanB can you Pls look into this Question one more time I have changed my error traces. Commented Mar 5, 2020 at 7:49

1 Answer 1

0

You are using ID of the Table and checkbox is inside that table, so you need to pass locator of the check box.

As there is no id defined for the checkbox, so using xpath to reach the locator like - //input[@type='checkbox']

Sign up to request clarification or add additional context in comments.

6 Comments

i have tried these options driver.find_elements_by_xpath('//*[@id="workflow_table"]/thead/tr/th[1]/input').click(), WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, "//input[@type='checkbox']"))).click(). But nothing worked out
getting Error-selenium.common.exceptions.InvalidSessionIdException: Message: invalid session id
Hi, for invalid session id error ,please check compatible version of selenium and driver, which version you are using?Follow this answer stackoverflow.com/questions/53739852/…
Driver is working Fine and it is Compatible with current Python + Selenium.
I am using Python version as 3.7 and Selenium driver version-3.141.0 and Chrome driver version-81.0.4044.20. I have changed my question and error stack trace a bit, please have a look.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.