1
我有一個函數,它從DB讀取電子郵件並將其存儲在桌面上。在量角器中獲取currentUrl後,如何更改Url的第一部分?
該電子郵件是用於密碼重置電子郵件。即使在測試中,url也始終指向Prod。我需要將字符串的第一部分替換爲-test。我怎樣才能做到這一點?
browser.getCurrentUrl().then(function(CurrentUrl) {
var modifyUrl = CurrentUrl;// Getting current url
console.log(modifyUrl);//This one has the current Url
//The modifyUrl looks like this https://login.domain.com/reset/####..
//I want to replace just login to login-test
// I tried the following but I am getting Window is undefined message.
var URL = window(modifyUrl).location.toString();
window.location = URL.replace(/login/, 'login-test')
});
欣賞幫助
謝謝a bunchhhhhhhhhh ...工作。 :) – user2744620