How to go to a particular link in protractor?
11,716
Solution 1
You could use browser.get eg;
browser.get(browser.baseurl+'/link');
Ref https://github.com/angular/protractor/blob/master/docs/tutorial.md
Solution 2
You should be able to do it with
driver.get(url);
where url
is the link to the page you want to go.
Author by
TechnoCorner
“Computer science education cannot make anybody an expert programmer any more than studying brushes and pigment can make somebody an expert painter.” - Eric S. Raymond
Updated on June 06, 2022Comments
-
TechnoCorner almost 2 years
I'm quite new to protractor. I want to explicitly tell protractor to open a particular url and do some action. How can I do that?
This is what i am currently doing right now.
((jasmine, driver) -> helpers = require(process.cwd() + '/../common/test/lib/helpers.coffee') timeout = helpers.defaultTimeout ############## Test cases ################## describe 'Going to the Connect pages and launch at dashboard', -> it 'Should login as admin and launch Location view', -> helpers.login(driver) expect(driver.wait ( -> return driver.getCurrentUrl().then (url) -> return /map/.test(url) && /loc/.test(url) ), timeout).toBeTruthy() it 'should navigate to the connect page and show dashboard view', -> element(By.xpath("//a[@href='/connection/']")).click() expect(driver.wait ( -> return driver.getCurrentUrl().then (url) -> return /dashboard/.test(url) && /conn/.test(url) ), timeout).toBeTruthy() )(jasmine, browser.driver)
So basically I am doing some stuff already in one page. Now if I want to context switch and go to another url how can I do that?
Thanks,