switchFrame
செயலில் உள்ள சூழலை ஒரு பிரேமிற்கு மாற்றுகிறது, எ.கா. பக்கத்தில் உள்ள ஒரு iframe. பக்கத்தில் ஒரு பிரேமை பல வழிகளில் நீங்கள் வினவலாம்:
-
ஒரு ஸ்ட்ரிங் கொடுக்கப்பட்டால், அது பொருந்தும் சூழல் ஐடி, url அல்லது அந்த ஸ்ட்ரிங்கைக் கொண்ட url உடன் பிரேமிற்கு மாறுகிறது
// switch to a frame that has a specific url or contains a string in the url
await browser.url('https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_iframe')
// Note: this frame is located in a nested iframe, however you only need to provide
// the frame url of your desired frame
await browser.switchFrame('https://www.w3schools.com')
// check the title of the page
console.log(await browser.execute(() => [document.title, document.URL]))
// outputs: [ 'W3Schools Online Web Tutorials', 'https://www.w3schools.com/' ] -
பிரேமின் சூழல் ஐடி உங்களிடம் இருந்தால் அதை நேரடியாகப் பயன்படுத்தலாம்
// switch to a frame that has a certain context id
await browser.switchFrame('A5734774C41F8C91D483BDD4022B2EF3')