javascript - How to change URL in protractor - Stack Overflow

I'm wondering how do you change the current URL upon pressing some button or link.browser.waitForA

I'm wondering how do you change the current URL upon pressing some button or link.

browser.waitForAngular();
expect(browser.driver.getCurrentUrl()).to.eventually.match(/document/).and.notify(callback);

I know this code will get the url and match it with document, I would like to set the URL upon a click.

e.g. I'm on Facebook and I want to go to profile, I click Profile button but want to update the URL by parsing a string value to it rather than a class/function

As I have a piece of code that doesn't have any classes to point to, the only thing I have is a href which contains the path location to the page.

I'm wondering how do you change the current URL upon pressing some button or link.

browser.waitForAngular();
expect(browser.driver.getCurrentUrl()).to.eventually.match(/document/).and.notify(callback);

I know this code will get the url and match it with document, I would like to set the URL upon a click.

e.g. I'm on Facebook and I want to go to profile, I click Profile button but want to update the URL by parsing a string value to it rather than a class/function

As I have a piece of code that doesn't have any classes to point to, the only thing I have is a href which contains the path location to the page.

Share Improve this question edited Apr 28, 2015 at 20:19 alecxe 475k127 gold badges1.1k silver badges1.2k bronze badges asked Apr 28, 2015 at 18:04 PauliePaulie 7,0354 gold badges21 silver badges36 bronze badges 1
  • Are you looking for something like browser.get() or browser.driver.get()?angular.github.io/protractor/#/… – Aaron Commented Apr 28, 2015 at 18:26
Add a ment  | 

1 Answer 1

Reset to default 3

Why don't actually let the browser navigate to the new URL on click, get it via browser.getCurrentUrl(), modify it and navigate to the modified URL, e.g.

button.click();

browser.getCurrentUrl().then(function (url) {
    browser.get(url + "?a=b");
});

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745353446a4623976.html

相关推荐

  • javascript - How to change URL in protractor - Stack Overflow

    I'm wondering how do you change the current URL upon pressing some button or link.browser.waitForA

    2小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信