0

I'm trying to convert a working capybara code into site prism.

photo_upload_page.execute_script("$('#dobpicker').val('1973-12-16')")

Site prism file

element :dobpicker, '#dobpicker', :val, '1973-12-16'

Spec file

photo_upload_page.execute_script(photo_upload_page.dobpicker)

Error

Selenium::WebDriver::Error::UnknownError:
       unknown error: Runtime.evaluate threw exception: SyntaxError: Invalid or unexpected token
khoamle
  • 676
  • 2
  • 7
  • 21
  • execute_script takes a string and you're trying to pass it a site_prism object?? Additionally your `element` definition passes :val and '1973-12-16' which will do nothing and just be ignored since they aren't valid parameters to a capybara find call. What exactly are you trying to do? – Thomas Walpole Jun 13 '16 at 21:38
  • I'm trying to write the working capybara into working spec code with site prism. The execute script code works and I'm trying to convert it to the same equivalent in site prism – khoamle Jun 13 '16 at 22:07
  • If the capybara code had to be written as execute_script (because #dobpicker is a widget that can't be called with `#set` for instance) then there is no site prism version - If you could/should have written the capybara as `find('#dobpicker').set('1973-12-16')` then the site_prism equivalent would be `phtoto_upload_page.dobpicker.set('1973-12-16')` -- assuming photo_upload_page is your site_prism page object (which isn't exactly clear since it's used in the original line and third line) – Thomas Walpole Jun 13 '16 at 22:33
  • Thanks. I will just keep it as it is. – khoamle Jun 23 '16 at 21:27

0 Answers0