ChromeDriver .click causing errors when interacting with onclick() function

I am trying to click on the below element using ChromeDriver .click(). It is one of the columns in a row of a table that contains bills.

<td onclick="ShowAdvancedTimeEntry(1,0,0,'276984899',0,generateRandom());return false;">TG</td>

Here is how I am trying to click on it in bare bones. I have also tried clicking right on the element with wait_element = data_bill[5].

bills_xpath = './/tr[@class="rowb"]'
bills = group.find_elements(By.XPATH, bills_xpath)
for j, bill in enumerate(bills):
   data_bill = bill.find_elements(By.TAG_NAME, 'td')
   wait_element = data_bill[5].find_element(By.XPATH, './/div//span')
   wait_element.click()
      for window in all_windows: 
         if window != original_window:
            d.switch_to.window(window)
            #get needed data from this window#
            d.close()                         
            d.switch_to.window(original_window)

When done manually, this pops up a new window with additional information about the bill represented by that row of data.

However, when using the ChromeDriver click, I am triggering the below dynamic error display in the HTML of the destination page:

<!-- ko if: false -->
            <div id="refreshOverlay" class="timersRefreshing" style="z-index:1">
                Loading...
            </div>
<!-- /ko -->
<!-- #region TIMER -->

I am also getting these three errors which are not present when manually clicking the link.
screenshot of error messages

From what I have been able to gather, it seems like using the .click is causing errors in the jquery (maybe an Ajax call), but I am not familiar enough with jquery to get to the bottom of this. Does anyone know why these errors are happening or have more information about why Chromedriver .click functions differently than manually clicking?

I have tried setting the ChromeDriver options with the below commands:

chrome_options = Options()
chrome_options.add_argument("--disable-extensions")
chrome_options.page_load_strategy = 'eager'
d = webdriver.Chrome(service=Service(executable_path=driver_path), options=chrome_options)

I have also tried various iterations of waiting for the page to load and the Ajax processes to complete. The page is loading successfully since what I am seeing is supposed to be displayed, but maybe the jquery functions aren’t being allowed time to finish?

wait = WebDriverWait(d, 15)
wait_element = data_bill[5].find_element(By.XPATH, './/div//span')
                            #wait.until(ec.element_to_be_clickable((By.XPATH,wait_element)))
is_ajax_complete = "return jQuery.active == 0"  # This works for jQuery-based websites                
wait.until(lambda d: d.execute_script(is_ajax_complete))
wait_element.click()
wait.until(lambda driver: driver.execute_script('return document.readyState') == 'complete')
wait.until(ec.presence_of_element_located((By.XPATH, '//*[@id="billableType"]/div[1]/label[1]/input')))

I made attempts at passing an authtoken and waiting for the element to be clickable but did not have much luck.

New contributor

Trent Giffin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

4

It was a cookie issue. The domain of the website I was using had changed between writing the code and adding this new functionality. The cookies were stored with the new domain, but the code was loaded a page with the old domain. It routed to the page, but then failed to load via on click because the website domain did not match the domain stored in the cookies.

New contributor

Trent Giffin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa

ChromeDriver .click causing errors when interacting with onclick() function

I am trying to click on the below element using ChromeDriver .click(). It is one of the columns in a row of a table that contains bills.

<td onclick="ShowAdvancedTimeEntry(1,0,0,'276984899',0,generateRandom());return false;">TG</td>

Here is how I am trying to click on it in bare bones. I have also tried clicking right on the element with wait_element = data_bill[5].

bills_xpath = './/tr[@class="rowb"]'
bills = group.find_elements(By.XPATH, bills_xpath)
for j, bill in enumerate(bills):
   data_bill = bill.find_elements(By.TAG_NAME, 'td')
   wait_element = data_bill[5].find_element(By.XPATH, './/div//span')
   wait_element.click()
      for window in all_windows: 
         if window != original_window:
            d.switch_to.window(window)
            #get needed data from this window#
            d.close()                         
            d.switch_to.window(original_window)

When done manually, this pops up a new window with additional information about the bill represented by that row of data.

However, when using the ChromeDriver click, I am triggering the below dynamic error display in the HTML of the destination page:

<!-- ko if: false -->
            <div id="refreshOverlay" class="timersRefreshing" style="z-index:1">
                Loading...
            </div>
<!-- /ko -->
<!-- #region TIMER -->

I am also getting these three errors which are not present when manually clicking the link.
screenshot of error messages

From what I have been able to gather, it seems like using the .click is causing errors in the jquery (maybe an Ajax call), but I am not familiar enough with jquery to get to the bottom of this. Does anyone know why these errors are happening or have more information about why Chromedriver .click functions differently than manually clicking?

I have tried setting the ChromeDriver options with the below commands:

chrome_options = Options()
chrome_options.add_argument("--disable-extensions")
chrome_options.page_load_strategy = 'eager'
d = webdriver.Chrome(service=Service(executable_path=driver_path), options=chrome_options)

I have also tried various iterations of waiting for the page to load and the Ajax processes to complete. The page is loading successfully since what I am seeing is supposed to be displayed, but maybe the jquery functions aren’t being allowed time to finish?

wait = WebDriverWait(d, 15)
wait_element = data_bill[5].find_element(By.XPATH, './/div//span')
                            #wait.until(ec.element_to_be_clickable((By.XPATH,wait_element)))
is_ajax_complete = "return jQuery.active == 0"  # This works for jQuery-based websites                
wait.until(lambda d: d.execute_script(is_ajax_complete))
wait_element.click()
wait.until(lambda driver: driver.execute_script('return document.readyState') == 'complete')
wait.until(ec.presence_of_element_located((By.XPATH, '//*[@id="billableType"]/div[1]/label[1]/input')))

I made attempts at passing an authtoken and waiting for the element to be clickable but did not have much luck.

New contributor

Trent Giffin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

4

It was a cookie issue. The domain of the website I was using had changed between writing the code and adding this new functionality. The cookies were stored with the new domain, but the code was loaded a page with the old domain. It routed to the page, but then failed to load via on click because the website domain did not match the domain stored in the cookies.

New contributor

Trent Giffin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật