0

We have automation test scripts (Around 70) written using selenium web driver for Salesforce classic and able to execute without any error.

Now we are moving into Salesforce lightning, when I am trying to execute same automation test scripts (Around 70) on lightning throws error with respect to finding elements .

After investigating the error came to know that elements html tags are different in lightning compared to classic.

Please find below information.

Eg :In New LEAD Object ,

In Salesforce classic - LastName field Xpath is -- >input[@id='name_lastlea2']

In Salesforce lightning - LastName field Xpath is -- > //input[@id='450:2948;a']

Please let me know what approach I should do now to execute all my 70 test cases without any errors in Salesforce lightning.

My scripts should run in both Salesforce classic and lightning.

Thanks in advance .

Raghunandan N
  • 11
  • 1
  • 1
  • 2
  • You can get the current URL from driver object and decide which locator to use. – Magesh Aug 30 '18 at 13:32
  • Yes Magesh,Thanks . But here current problem is without making changes to existing locators in Classic scripts can I run same scripts in Lightning and How ?. – Raghunandan N Aug 30 '18 at 13:45
  • @Raghunandan You add an extra line to switch from Lightening to Classic which is on the top right corner of the salesforce and then start the test cases. This could be something that runs in your before or beforetest. Hope this will help you not change the entire code. – PJAutomator Aug 30 '18 at 13:50
  • @PJAutomator, that can do and handle in beforetest. My problem is change in locators . Whatever locators I used in classic are not working in lightning due to change in tags . – Raghunandan N Aug 30 '18 at 13:53
  • @RaghunandanN for that you have to change the locator and codes as well IMHO since they have changed. As far as testing the logic/service and form values, testing in one should suffice but check with your organizational need. – PJAutomator Aug 30 '18 at 13:58
  • 1
    @RaghunandanN The difference between lightning components and classic is HUGE, right off the bath you're going to have to redo most if not all your locators because it's different components. Next you'll have to look at the logic to see if there are things that no longer exists, flows and pages are also very different. As someone suggested earlier you can have a flag for doing classic vs lightning but i'd imagine you're going to have to re-write a large portion of your tests for lightning. – so cal cheesehead Aug 30 '18 at 14:34
  • @so cal cheesehead Thanks – Raghunandan N Aug 31 '18 at 06:11
  • @so cal cheesehead, with respect to locators shall I use 2 locators properties files in my framework , one for classic and one for Lightening and call locators properties file based on execution either classic or Lightening ? – Raghunandan N Aug 31 '18 at 06:19
  • @RaghunandanN That's really up to you and how you want to manage that but that would make sense to me. – so cal cheesehead Aug 31 '18 at 17:41
  • What I observed so far is both UI in Lightening and classic are different. In lightening there are lot of iframes used. So you have to use different approach for that. So it's better to write separate code for that. – peter pawar Sep 21 '18 at 06:09

0 Answers0