One of the useful features of QAF, while testing the code, is using running webdriver session. Following are the steps:
- Start selenium server.
- Navigate to http://localhost:4444/wd/hub/static/resource/hub.html in browser.
-
Create a new session.
-
Select browser and click ok. It will create a new session for selected browser.
-
Set appropriate remote driver as browser and “webdriver.remote.session”. For example in this case:
driver.name=firefoxRemoteDriver webdriver.remote.session=c21c48ce-3256-47a7-aa86-f3476ffa0060
- Navigate to the page manually in the browser.
-
Start executing code snippet for test on that page. For example in following case I navigated to the page and opened calendar to test calendar component by following test code.
@Test void test1() { WebCalendar calendar = new WebCalendar(WebHomePageLocators.CALENDAR_COMPONENT_LOC); calendar.setDates(DateUtil.getDate(25), DateUtil.getDate(30)); }
- I can run/debug above snippet as testng test to test different aspects or to reproduce any defective behavior.