0

I am trying to automate a script using Kantu in Salesforce. Basically I am going through some dropdown IDs and select the right values and everything works IF the selectFrame value is correct in the beginning.

The problem is that Salesforce refreshes the iframe ID everytime the page is refreshed or a new case is opened (i.e. ext-comp-1018 | ext-comp-1035 | ext-comp-1048 etc.)

Because the script does not recognize the frame (since it is always changing), it won't go ahead to do the rest of the actions.

{

   "Name": "SFDC_Auto",

   "CreationDate": "2019-3-25",

   "Commands": [

    {
      "Command": "selectFrame",
      "Target": "id=ext-comp-1018",
      "Value": ""
    },
    {
      "Command": "select",
      "Target": "id=cas5",
      "Value": "label=Escalation"
    },

I seen a post that mentioned this would be the solution, but I am not sure how to implement it in Kantu: frames = @driver.find_elements(:xpath, '//iframe[starts-with(@id,ext- comp-)]') @driver.switch_to.frame frames1

So far I could make this work: xpath=//iframe[starts-with(@id,ext-comp-)], however it doesn't do nothing. It reads ok but then halts at the next step saying that ID CAS5 is not recognized.

Can anyone help out?

Thanks,

Slider105
  • 45
  • 1
  • 2
  • 8
  • 1
    Please make a reference to the post you mentioned – N8888 Mar 25 '19 at 19:06
  • you missed single quotes around `ext-comp-` the xpath should be `//iframe[contains(@id,'ext-comp-')]` – supputuri Mar 25 '19 at 19:20
  • If you want to use css then `@driver.find_elements(:css, "iframe[id^='ext- comp-']")` is the correct one. – supputuri Mar 25 '19 at 19:24
  • @supputuri, this is what I get when I run those: **Code:** //iframe[contains(@id,'ext-comp-')] **Output:** [error] timeout reached when looking for element 'id=cas5' [error] **Code:** @driver.find_elements(:css, "iframe[id^='ext- comp-']") **Output:** [error] timeout reached when looking for frame '@driver.find_elements(:css, "iframe[id^='ext- comp-']")' – Slider105 Mar 25 '19 at 19:36
  • @N8888 this was the one: https://stackoverflow.com/questions/44897298/access-frame-via-relative-up-with-selenium-ruby – Slider105 Mar 25 '19 at 19:37
  • Sorry to ask this question, which language you are using (Java, C#, Ruby, Python)? – supputuri Mar 25 '19 at 19:45
  • @supputuri I'm fairly new to browser automation but I believe Kantu uses JSON. See here in the screenshot: http://i67.tinypic.com/rmtohd.jpg As you can see the highlighted code does not run. If I run from the second code to the bottom, it works. But the problem is that the id=ext-comp-1018 is static and in Salesforce it keeps changing. I need to find a way to always detect the correct one in order to perform the rest of the operations. – Slider105 Mar 25 '19 at 19:57

0 Answers0