0

Recently I've used command "selectFrame > relative=up" in Selenium IDE to switch between nested frames. Since i've decided to rewrite all code in Selenium and Ruby, i can't find this command analog for mentioned language.

I can't select frame by name because it different after any reload. Other frame attributes are:

iframe id="ext-comp-1465" name="ext-comp-1465" frameborder="0" src="/5005700001V96Ub/e?retURL=%2F5005700001V96Ub&amp;isdtp=vw&amp;cancelURL=%2F5005700001V96Ub&amp;nonce=a37ade0829c6d08539a765cd370dff0766cd596851439e853d68a60e9d7c28d0&amp;sfdcIFrameOrigin=https%3A%2F%2F*************.com" class=" x-border-panel" style="left: 0px; top: 0px; width: 329px; height: 641px;"></iframe

Please advise how i can get to this frame using "relative=up" option or other frame attributes. Thanks in advance.

Guy
  • 46,488
  • 10
  • 44
  • 88
Nikita
  • 5
  • 3

2 Answers2

0

Try the following,

driver.switch_to.frame "ext-comp-1465"

or

driver.switch_to.frame driver.find_element(id: 'ext-comp-1465')

or

driver.switch_to.frame driver.find_element(name: 'ext-comp-1465')

or

driver.switch_to.frame driver.find_element(xpath: '//iframe[starts-with(@id,"ext-comp-"] ')
Murthi
  • 5,299
  • 1
  • 10
  • 15
  • thanks, but frame name & id are different any time i reload the page - ext-comp-1087 or ext-comp-1055 e.t.c. I need another solution – Nikita Jul 04 '17 at 12:25
  • Then try with xpath like //iframe[starts-with(@id,"ext-comp-"] driver.switch_to.frame driver.find_element(xpath: '//iframe[starts-with(@id,"ext-comp-"] '). updated in answer section as well. – Murthi Jul 04 '17 at 12:40
0

Final solution:

frames = @driver.find_elements(:xpath, '//iframe[starts-with(@id,ext-comp-)]')
@driver.switch_to.frame frames[1]
Nikita
  • 5
  • 3