Search code examples
watir-webdriverpage-object-gem

click_no_wait and then execute_script


I'm using the page object gem with a page that contains a link.

When the link is clicked, the browser navigates to a new page, and the HTML renders as expected.

However, my script is always returning a Timeout::Error: Timeout::Error. After looking at the browser network activity, I noticed a pattern with a long running get that never completes.

If I run the script and then go to the console and issue the command $.connection.hub.stop(), the script will not time out.

Is there a way to perform a click_no_wait or to click and then execute a script via the use of page_object_gem ?

Here is my page-object attempt, but it is resulting in a timeout still.

class MyThing

   include  PageObject
   include  PageObject::PageFactory

   link(:show_details, :id => 'detailLink')

   def click_show_details_no_wait
     begin
        show_details_element.click
     rescue Exception => e
       execute_script('$.connection.hub.stop();')
     end
   end 

end

Solution

  • It is hard to suggest without your page. My first idea is to try to do

     show_details_element.fire_event('click')
    

    instead of a usual click.

    The second idea is take a look at

    Good luck.