From c8e522d40005a36f4110507d210c99fa0f13e1ff Mon Sep 17 00:00:00 2001 From: Matthew Smith Date: Fri, 18 Oct 2019 02:17:55 +0100 Subject: [PATCH] Fixed selenium "Object reference chain is too long" exception. It seems like it couldn't translate the value returned by the script --- RIGS/test_functional.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/RIGS/test_functional.py b/RIGS/test_functional.py index 6006e995..aa65158a 100644 --- a/RIGS/test_functional.py +++ b/RIGS/test_functional.py @@ -88,7 +88,7 @@ class UserRegistrationTest(LiveServerTestCase): initials.send_keys('JS') phone.send_keys('0123456789') self.browser.execute_script( - "return jQuery('#g-recaptcha-response').val('PASSED')") + "return function() {jQuery('#g-recaptcha-response').val('PASSED'); return 0}()") # Submit incorrect form submit = self.browser.find_element_by_xpath("//input[@type='submit']") @@ -110,8 +110,9 @@ class UserRegistrationTest(LiveServerTestCase): # Correct error password1.send_keys('correcthorsebatterystaple') password2.send_keys('correcthorsebatterystaple') + self.browser.execute_script("console.log('Hello, world!')") self.browser.execute_script( - "return jQuery('#g-recaptcha-response').val('PASSED')") + "return function() {jQuery('#g-recaptcha-response').val('PASSED'); return 0}()") # Submit again password2.send_keys(Keys.ENTER) @@ -150,7 +151,7 @@ class UserRegistrationTest(LiveServerTestCase): username.send_keys('TestUsername') password.send_keys('correcthorsebatterystaple') self.browser.execute_script( - "return jQuery('#g-recaptcha-response').val('PASSED')") + "return function() {jQuery('#g-recaptcha-response').val('PASSED'); return 0}()") password.send_keys(Keys.ENTER) # Check we are logged in