-
Notifications
You must be signed in to change notification settings - Fork 585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do I visit dynamic URLs other than hacking https:// and http:// steps? - Example of defining custom functions by users for their use cases #236
Comments
@Aussiroth's reply The issue here is that TagUI determines if the step is to load a URL or not by doing the following 3 steps - if the line starts with http://, or https:// or about:blank. So if you try to use something like '+url+' without those at the start TagUI can't interpret that you definitely want to go to a URL since it doesn't know what the variable content is (at the PHP processing part). Previously my method was similar to yours in that I would manually perform a https://'+url+' to go to the url in tagui. Perhaps Ken will have some further ideas on this. |
user's reply Thanks for the explanation! Since you can test for "line that starts with http://, or https:// or about:blank" Is it possible to add one more: "line that starts with http://, or https:// or about:blank OR gotourl" If there's a gotourl, we can then do a without the need to do a convoluted way of removing and adding back the http:// and http:// For your consideration, please. |
my reply Try this. TagUI v4.0 will look for a tagui_local.js file in same folder of script and tagui_global.js in tagui\src folder for user-defined custom functions. Below example shows the custom function gotourl defined and used. demo.txt
tagui_local.js function gotourl(link) { // this custom function goes to the url provided
casper.evaluate(function(link) {window.location.href = link;}, link);
} output
|
decided to not implement this as a new step. because it can go down the rabbit hole to include back step to go back to the previous page and many other new steps. will let users who need something like this implement by writing their own user-defined functions in tagui_local.js or tagui_global.js going to update readme documentation with reference to the example above - #236 (comment) |
how to get url for newly launched tab. I have a scenario i need to click on a link which will opens a new tab. i want to get the url of newly launched tab. can any one help me |
Hi Pallav, from #392 I see you mean getting the URL of the updated webpage URL. You can use the url() helper function to do that -
For a list of other useful helper functions, see https://github.com/kelaberetiv/TagUI#helper-functions |
hi Kensoh 2.click //a[text()="Click Here"] 3.echo url() in step 3 it is returning the launched url (http://demo.guru99.com/popup.php) but when i perform step 2 a new tab will be opened so i need the what url is launched in step 2 |
user query
Something simple, I can do it a long way, but just want to see if there's a better way to do this in TagUI.
Suppose I grabbed a url from a page using:
read //a/@href to url
Then I want to go to that page to grab the details from that page.
Suppose url = https://google.com
Since url is a variable, I tried
'+url'+
It gives the error message: ERROR - cannot understand step '+url+'
Using the long way I can do this. One for https://
url = url.replace(/https:///g, "");
https://'+url+'
Another for http://
url = url.replace(/http:///g, "");
http://'+url+'
I tried the following - so that it can handle both http:// and https://. But it didn't work:
url = url.replace(/https:/g, "");
https'+url+'
For your advice, please.
The text was updated successfully, but these errors were encountered: