click_no_wait 然后 execute_script

click_no_wait and then execute_script

我将页面对象 gem 与包含 link.

的页面一起使用

单击 link 时,浏览器导航到新页面,HTML 按预期呈现。

但是,我的脚本总是返回 Timeout::Error: Timeout::Error。在查看浏览器网络 activity 之后,我注意到一个带有长 运行ning get 的模式永远不会完成。

如果我 运行 脚本然后转到控制台并发出命令 $.connection.hub.stop(),脚本不会超时

有没有办法执行 click_no_wait 或通过使用 page_object_gem 单击然后执行脚本?

这是我的页面对象尝试,但仍然导致超时。

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

没有您的页面很难提出建议。我的第一个想法是尝试做

 show_details_element.fire_event('click')

而不是通常的点击。

第二个想法是看看

  • Stop loading page watir-webdriver

  • Is there have method to stop page loading in watir-webdriver

  • how to click on browser “stop loading this page” using ruby watir?

祝你好运。