Webdriver(Selenium2) - How to make selenium operate elements without wating for connecting to external AD links? -
environment:
- selenium 2.39 standalone server
- php 5.4.11
- phpunit 3.7.28
- chrome v31 & chromedriver v2.7
i'm testing website,which invokes lot of advertisement systems,such google ad.
browser takes lot of time connect external ad links , elements of page has been loaded.
if internet network not fast when ran tests on webpage, selenium wait long time ,since ad links responsed slowly.
under condition ,selenium waits on 60 seconds, , throws timeout exception.
i'm not sure how senelium works, seems selenium has wait sign of webpage's full loading, pulls dom find elements.
i want make selenium operate elements without waiting connectiong external ad links.
there way ? thank much.
i suggest make use of proxy. browsermob integrates selenium, easy use it:
// start proxy proxyserver server = new proxyserver(4444); server.start(); // selenium proxy object proxy proxy = server.seleniumproxy(); // line automatically return http.200 request going google analytics server.blacklistrequests("https?://.*\\.google-analytics\\.com/.*", 200); // configure desired capability desiredcapabilities capabilities = new desiredcapabilities(); capabilities.setcapability(capabilitytype.proxy, proxy); // start browser webdriver driver = new firefoxdriver(capabilities);
i'm not sure how senelium works, seems selenium has wait sign of webpage's full loading, pulls dom find elements.
it pretty this. default loading strategy "normal" means:
normal of type domstring remote end must wait until "document.readystate" of frame handling commands equals "complete", or there no more outstanding network requests other xmlhttprequests.
Comments
Post a Comment