after the chapter 6 git hard reset I get this Unable to locate element: {"method":"id","selector":"i

158 views
Skip to first unread message

Mitch Raful

unread,
Apr 23, 2015, 12:15:14 PM4/23/15
to obey-the-test...@googlegroups.com
I've tried everything.  I've compared the code on git hub with what I have and still can't figure it out.  I have printed the table rows to make sure they're there and 1. Peacock feathers is there... I don't get it.  Below is my test_can_start list, as that's where the error comes from according to the output


def test_can_start_a_list_and_retrieve_it_later(self):
# Edith has heard about a cool new online to-do app. She goes to check its homepage
self.browser.get(self.live_server_url)

# She notices the page title and header mention to-do lists
self.assertIn('To-Do', self.browser.title)
header_text = self.browser.find_element_by_tag_name('h1').text
self.assertIn('To-Do', header_text )

inputbox = self.browser.find_element_by_id('id_new_item')
self.assertEqual( inputbox.get_attribute('placeholder'), 'Enter a to-do item')
inputbox.send_keys('Buy peacock feathers')
inputbox.send_keys(Keys.ENTER)
edith_list_url = self.browser.current_url
self.assertRegex(edith_list_url, '/lists/.+')
self.check_for_row_in_list_table('1: Buy peacock feathers')

inputbox = self.browser.find_element_by_id('id_new_item')
inputbox.send_keys('Use peacock feathers to make a fly' )
inputbox.send_keys(Keys.ENTER)

self.check_for_row_in_list_table('1: Buy peacock feathers')
self.check_for_row_in_list_table('2: Use peacock feathers to make a fly')

#New user comes along to the site
## We're closing and opening the browser to create a new session
## to check that none of Edith's stuff comes through cookies, etc
self.browser.quit()
self.browser = webdriver.Firefox()

#Check new user doesn't see Edith's list
self.browser.get(self.live_server_url)
page_text = self.browser.find_element_by_tag_name('body').text
self.assertNotIn('Buy peacock feathers', page_text)
self.assertNotIn('make a fly', page_text)

#New user, Francis, starts a new list
inputbox = self.browser.find_element_by_id('id_new_item')
inputbox.send_keys('Buy milk')
inputbox.send_keys(Keys.ENTER)

#New user gets unique url
francis_list_url = self.browser.current_url
self.assertRegex(francis_list_url, '/lists/.+')
self.assertNotEqual(francis_list_url, edith_list_url)

#Let's double check for the first user's, Edith, list
page_text = self.browser.find_element_by_tag_name('body').text
self.assertNotIn('Buy peacock feathers', page_text)
self.assertIn('Buy milk', page_text)

Any ideas??

Mitch

Harry Percival

unread,
Apr 23, 2015, 12:16:49 PM4/23/15
to obey-the-test...@googlegroups.com
What's the problem exactly?

--
You received this message because you are subscribed to the Google Groups "Obey the testing goat! Test-Driven Web Development with Python book" group.
To unsubscribe from this group and stop receiving emails from it, send an email to obey-the-testing-go...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
------------------------------
Harry J.W. Percival
------------------------------
Twitter: @hjwp
Mobile:  +44 (0) 78877 02511
Skype:         harry.percival

Mitch Raful

unread,
Apr 23, 2015, 12:21:12 PM4/23/15
to obey-the-test...@googlegroups.com
I am sorry, I didn't post the entire error....  id_list_table is the element that can not be found.

Mitch

Mitch Raful

unread,
Apr 23, 2015, 12:31:38 PM4/23/15
to obey-the-test...@googlegroups.com, hj...@cantab.net
When running the functional test it loads up the input boxes.  On the browser I get The requested URL /lists//add_item was not found on this server.  Then it launches the window for the second user  with the Start a to do list window, then I get this from the test

raceback (most recent call last):
  File "/Users/mitchellraful/Desktop/tdd/superlists/functional_tests/tests.py", line 44, in test_can_start_a_list_and_retrieve_it_later

    self.check_for_row_in_list_table('1: Buy peacock feathers')
  File "/Users/mitchellraful/Desktop/tdd/superlists/functional_tests/tests.py", line 16, in check_for_row_in_list_table
    table = self.browser.find_element_by_id('id_list_table')
  File "/Users/mitchellraful/Desktop/tdd/lib/python3.4/site-packages/selenium/webdriver/remote/webdriver.py", line 208, in find_element_by_id
    return self.find_element(by=By.ID, value=id_)
  File "/Users/mitchellraful/Desktop/tdd/lib/python3.4/site-packages/selenium/webdriver/remote/webdriver.py", line 664, in find_element
    {'using': by, 'value': value})['value']
  File "/Users/mitchellraful/Desktop/tdd/lib/python3.4/site-packages/selenium/webdriver/remote/webdriver.py", line 175, in execute
    self.error_handler.check_response(response)
  File "/Users/mitchellraful/Desktop/tdd/lib/python3.4/site-packages/selenium/webdriver/remote/errorhandler.py", line 166, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: {"method":"id","selector":"id_list_table"}
Stacktrace:
    at FirefoxDriver.prototype.findElementInternal_ (file:///var/folders/pv/xbvh6cvj1p90t6r28mj4gn2c0000gn/T/tmpridmesoj/extensions/fxdr...@googlecode.com/components/driver-component.js:10271)
    at fxdriver.Timer.prototype.setTimeout/<.notify (file:///var/folders/pv/xbvh6cvj1p90t6r28mj4gn2c0000gn/T/tmpridmesoj/extensions/fxdr...@googlecode.com/components/driver-component.js:603)

Hope that's clearer.
To unsubscribe from this group and stop receiving emails from it, send an email to obey-the-testing-goat-book+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Harry Percival

unread,
Apr 23, 2015, 12:36:50 PM4/23/15
to obey-the-test...@googlegroups.com
I still don't know what point in the book you're at.  And, if you're saying this happens after we've built the second browser window, then why is it checking for "buy peacock feathers"?  that's in the first browser window...

To unsubscribe from this group and stop receiving emails from it, send an email to obey-the-testing-go...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
------------------------------
Harry J.W. Percival
------------------------------
Twitter: @hjwp
Mobile:  +44 (0) 78877 02511
Skype:         harry.percival

--
You received this message because you are subscribed to the Google Groups "Obey the testing goat! Test-Driven Web Development with Python book" group.
To unsubscribe from this group and stop receiving emails from it, send an email to obey-the-testing-go...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Mitch Raful

unread,
Apr 23, 2015, 1:03:50 PM4/23/15
to obey-the-test...@googlegroups.com, hj...@cantab.net
Sorry, I am in Chapter 7, did the git reset --hard. Added bootstrap but not have changed to inherited templates yet.  It does appear to make it past the check peacock feathers, then I get the The requested URL /lists//add_item was not found on this server. in the browser.   The second browser window opens and that's when I get the test failure.  I'm not getting input boxes for Francis.

Mitch


On Thursday, April 23, 2015 at 12:36:50 PM UTC-4, Harry Percival wrote:
I still don't know what point in the book you're at.  And, if you're saying this happens after we've built the second browser window, then why is it checking for "buy peacock feathers"?  that's in the first browser window...
On 23 April 2015 at 17:31, Mitch Raful <mitch...@gmail.com> wrote:
When running the functional test it loads up the input boxes.  On the browser I get The requested URL /lists//add_item was not found on this server.  Then it launches the window for the second user  with the Start a to do list window, then I get this from the test

raceback (most recent call last):
  File "/Users/mitchellraful/Desktop/tdd/superlists/functional_tests/tests.py", line 44, in test_can_start_a_list_and_retrieve_it_later
    self.check_for_row_in_list_table('1: Buy peacock feathers')
  File "/Users/mitchellraful/Desktop/tdd/superlists/functional_tests/tests.py", line 16, in check_for_row_in_list_table
    table = self.browser.find_element_by_id('id_list_table')
  File "/Users/mitchellraful/Desktop/tdd/lib/python3.4/site-packages/selenium/webdriver/remote/webdriver.py", line 208, in find_element_by_id
    return self.find_element(by=By.ID, value=id_)
  File "/Users/mitchellraful/Desktop/tdd/lib/python3.4/site-packages/selenium/webdriver/remote/webdriver.py", line 664, in find_element
    {'using': by, 'value': value})['value']
  File "/Users/mitchellraful/Desktop/tdd/lib/python3.4/site-packages/selenium/webdriver/remote/webdriver.py", line 175, in execute
    self.error_handler.check_response(response)
  File "/Users/mitchellraful/Desktop/tdd/lib/python3.4/site-packages/selenium/webdriver/remote/errorhandler.py", line 166, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: {"method":"id","selector":"id_list_table"}
Stacktrace:
    at FirefoxDriver.prototype.findElementInternal_ (file:///var/folders/pv/xbvh6cvj1p90t6r28mj4gn2c0000gn/T/tmpridmesoj/extensions/fxdriv...@googlecode.com/components/driver-component.js:10271)
    at fxdriver.Timer.prototype.setTimeout/<.notify (file:///var/folders/pv/xbvh6cvj1p90t6r28mj4gn2c0000gn/T/tmpridmesoj/extensions/fxdriv...@googlecode.com/components/driver-component.js:603)
To unsubscribe from this group and stop receiving emails from it, send an email to obey-the-testing-goat-book+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
------------------------------
Harry J.W. Percival
------------------------------
Twitter: @hjwp
Mobile:  +44 (0) 78877 02511
Skype:         harry.percival

--
You received this message because you are subscribed to the Google Groups "Obey the testing goat! Test-Driven Web Development with Python book" group.
To unsubscribe from this group and stop receiving emails from it, send an email to obey-the-testing-goat-book+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Mitch Raful

unread,
Apr 24, 2015, 10:01:45 AM4/24/15
to obey-the-test...@googlegroups.com, hj...@cantab.net
Getting closer, if I plug this in...

<form method="POST" action="/lists/1/add_item">

it works. Why no list_id???

Koby Karp

unread,
Aug 30, 2016, 8:20:36 AM8/30/16
to Obey the testing goat! Test-Driven Web Development with Python book, hj...@cantab.net
I had the same issue.

This modification cleared the error:

<form method="POST" action="/lists/new">

instead of

<form method="POST" action="/lists/{{ list.id }}/add_item">

in home.html.

Harry Percival

unread,
Dec 28, 2016, 3:12:22 PM12/28/16
to Koby Karp, Obey the testing goat! Test-Driven Web Development with Python book
By the end of chapter 6, home.html should definitely have "/lists/new".  Only lists.html should have the {{ list_id }}.

https://github.com/hjwp/book-example/tree/chapter_06/lists/templates



    at FirefoxDriver.prototype.findElementInternal_ (file:///var/folders/pv/xbvh6cvj1p90t6r28mj4gn2c0000gn/T/tmpridmesoj/extensions/fxdr...@googlecode.com/components/driver-component.js:10271)
    at fxdriver.Timer.prototype.setTimeout/<.notify (file:///var/folders/pv/xbvh6cvj1p90t6r28mj4gn2c0000gn/T/tmpridmesoj/extensions/fxdr...@googlecode.com/components/driver-component.js:603)
To unsubscribe from this group and stop receiving emails from it, send an email to obey-the-testing-go...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
------------------------------
Harry J.W. Percival
------------------------------
Twitter: @hjwp
Mobile:  +44 (0) 78877 02511
Skype:         harry.percival

--
You received this message because you are subscribed to the Google Groups "Obey the testing goat! Test-Driven Web Development with Python book" group.
To unsubscribe from this group and stop receiving emails from it, send an email to obey-the-testing-go...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
------------------------------
Harry J.W. Percival
------------------------------
Twitter: @hjwp
Mobile:  +44 (0) 78877 02511
Skype:         harry.percival

--
You received this message because you are subscribed to the Google Groups "Obey the testing goat! Test-Driven Web Development with Python book" group.
To unsubscribe from this group and stop receiving emails from it, send an email to obey-the-testing-go...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
--

--
Harry Percival
+44 78877 02511

Jeffrey Daube

unread,
Jan 19, 2017, 11:53:45 AM1/19/17
to Obey the testing goat! Test-Driven Web Development with Python book
Mitch

I had luck adding:

self.browser.implicitly_wait(3) at the beginning of the "check_for_row_in_list_table" within functional_tests/tests.py

Thank you

Jeff
Reply all
Reply to author
Forward
0 new messages