Tag: pageloadtimeout

Selenium中的pageLoadTimeout无效

我在Java中使用selenium使用下面的代码。 我正在添加4秒的pageLoadTimeout,但是,驱动程序继续等待,直到加载完整的页面。 有帮助吗? System.setProperty(“webdriver.gecko.driver”, System.getProperty(“user.home”) + “\\Desktop\\geckodriver.exe”); FirefoxBinary b = new FirefoxBinary(new File(System.getProperty(“user.home”) + “\\desktop\\Mozilla Firefox\\firefox.exe”)); FirefoxOptions options = new FirefoxOptions().setBinary(b); driver = new FirefoxDriver(options); //driver.manage().timeouts().implicitlyWait(1, TimeUnit.SECONDS); driver.manage().timeouts().pageLoadTimeout(4, TimeUnit.SECONDS); driver.get(“https://www.booking.com/hotel/in/the-taj-mahal-palace-tower.html?label=gen173nr-1FCAEoggJCAlhYSDNiBW5vcmVmaGyIAQGYATG4AQbIAQzYAQHoAQH4AQKSAgF5qAID;sid=338ad58d8e83c71e6aa78c67a2996616;dest_id=-2092174;dest_type=city;dist=0;group_adults=2;hip_dst=1;hpos=1;room1=A%2CA;sb_price_type=total;srfid=ccd41231d2f37b82d695970f081412152a59586aX1;srpvid=c71751e539ea01ce;type=total;ucfs=1&#hotelTmpl”); List facilitySectionList = driver.findElements(By.className(“facilitiesChecklistSection”));