We should avoid hard coding of paths in tests as this adds to portability of test from one machine other.
Note: If you are new to java and selenium then start with selenium java training videos . Since the advent of selenium there have been many plugin to test xPath / css selectors but you don’t need any of them if you have chrome browser. Using Chrome console you can test both xPath and css selectors. Launch website to be tested in chrome browser and hit F-12 and you would see chrome console opened in lower pane of application - Hit escape key and console would open another pane to write element locators - And now you can start writing xPath or css selectors in chrome console and test them - The syntax for writing css id - $$(“ ”) And hit the enter key. If your expression is right then html snippet of the application element corresponding to the css selector would be displayed - If you mouse over the html snippet in chrome console then it would highlight the corresponding element in application - If you want to clean console of previously wri
FYI: You can use Environment("varname"), you don't need the ".Value".
ReplyDeleteGood work otherwise!
How can we follow same practice in Selenium Automation Project?
ReplyDeleteExample: System.setProperty("webdriver.chrome.driver",
"D:/automation/myproject/src/chromedrivers/win7/chromedriver_2.exe"); or in pom.xml
C:/Users/OfficePC21/workspace/deletexslt/testxslt/testng.xml