I want to automate login process to flipkart by creating a function which is being called in an action
Function Website() 'this is the function
Systemutil.Run("iexplore.exe"), "http://www.flipkart.com"
End Function
Website() 'this is where the function is called in the action
The browser is opening but I don't know how to click on login without doing a record and run , but only through code and the function.
Please help me.
If you want to do it with descriptive programming, this would be a simple example:
(I used the direct login-page, because it is easier than clicking on that login link)
Website()
Function Website()
Systemutil.Run("iexplore.exe"), "https://www.flipkart.com/account/login?from=header"
set objPage = Browser("title:=Flipkart.com: Login.*").Page("title:=Flipkart.com: Login.*")
objPage.Sync()
objPage.WebEdit("html id:=login_email_id1").Set "UsernameXY"
objPage.WebEdit("html id:=login_password1").Set "SecretPassword"
objPage.WebButton("html id:=login-cta").Click()
End Function
You can choose two approaches from here.
1. Object Repository: Press Ctrl + R to Open object repository. Then add objects to your repository. Once you add them, Just Drag and drop.
Descriptive Programming: Just Like answer one
Related
I'm hard stuck with this one so any advice welcome!
Ive been trying to create a flow that goes to this website https://dlv.tnl-uk-uni-guide.gcpp.io/ and scrapes the data from each table in the Subject Areas drop down list. My knowledge of HTML is sketchy at best but from what I understand it's a dynamic html table that just refreshes with new data rather than going to a new url. I can extract the subject list as a variable and in my head i think i just need to add this to a UI selector action but despite numerous attempts i've got absolutely nowhere. Anyone got any ideas as to how i could fix this or work around?
Because it is not a conventional drop-down using the "Set drop-down list value on web page" doesn't work all that well.
You can use a bit of javascript and variables for this.
Hit F12 to show developer tools, you will see there is a list of hidden items with the class class="gug-select-items gug-select-hide" you will use this in the javascript.
Then add a 'Press button on web page' function and add the 'drop-down' element, which is a <div>
Then edit the element selector and change it to text editor.
then change the selector to make use of the nth-child(0) selector but use a variable for the index.
so it looks something like #gug-overall-ranking-select > div.gug-select-items > div:nth-child(%ddIdx%)
Use the "Run JavaScript function on web page" function to get the number of options available to the drop-down. (child elements)
The returned result is text, so convert it to a number that can be used in the loop.
function ExecuteScript() { /*your code here, return something (optionally); */
var firstDDlist = document.querySelector("#gug-overall-ranking-select > div.gug-select-items.gug-select-hide");
return firstDDlist.children.length;
}
In the loop each element will be pressed and cause the table to reload.
The table data extraction can then also be done in the loop, but that this code only shows the looping through the options.
The full flow 'code' (copy this and paste it in power automate).
WebAutomation.LaunchEdge.LaunchEdge Url: $'''https://dlv.tnl-uk-uni-guide.gcpp.io/?taxonomyId=36&/#gug-university-table''' WindowState: WebAutomation.BrowserWindowState.Normal ClearCache: False ClearCookies: False WaitForPageToLoadTimeout: 60 Timeout: 60 BrowserInstance=> Browser
WebAutomation.ExecuteJavascript BrowserInstance: Browser Javascript: $'''function ExecuteScript() { /*your code here, return something (optionally); */
var firstDDlist = document.querySelector(\"#gug-overall-ranking-select > div.gug-select-items.gug-select-hide\");
return firstDDlist.children.length;
}''' Result=> numberOfItems
Text.ToNumber Text: numberOfItems Number=> itemCount
LOOP ddIdx FROM 1 TO itemCount STEP 1
WebAutomation.PressButton.PressButton BrowserInstance: Browser Control: appmask['Web Page \'h ... sity-table\'']['Div \'gug-select-selected\''] WaitForPageToLoadTimeout: 60
END
It should end up looking like this:
Flow running:
With using Power Automate Desktop (PAD), the goal is to be a low-code solution. Of course knowing HTML is a bonus and will help you on tricky webpages or problems, but not knowing much is alright usually. I'm not really comfortable going to that web page you shared but you could try the below option.
PAD has a built in function in the action pane:
'Browser automation' > 'Web data extraction' > 'Extract data from web page'
Try using that and when asked to add UI Element select the table/dropdown list to see what information you get back. If that doesn't work you might need to try out JavaScript or another method.
Here is my Basic Code
The formFlow works fine and after checking the if condition ,it should go to the else part ,which it does, but in the else part the wrote this line of code
await Conversation.SendAsync(activity, () => new AskMeAnything());
AskMeAnything is a class implementing Idialog. The problem is ,its again going/calling the formflow rather than jumping into the above mentioned dialog.
I read about IdialogStack but unable to understand how to remove the dialog on top of stack or something related to it.
i need help in moving to other dialog without looping into formflow.
Thanks
The first time you call Conversation.SendAsync(...) you actually create a root dialog for your conversation. Every consecutive call to the bot will still enter the controller but will be routed to the dialog at the top of the stack.
So when you call Conversation.SendAsync(...) for a second time you are actually trying to change the root dialog in the stack. I don't think this is possible and that's why your form is called again.
To solve this problem I would create a different dialog and make that dialog your root dialog. From this root dialog you can call your form and any other dialog.
I am trying to build a test scenario for acceptance testing. In my scenario, I want to click on an non-editable input field to trigger a JqueryUI calendar, and then click a date from the calendar.
The problem is that I can't seem to find any actions in CodeCeption that allows you to click on something else than a an anchor or a button.
The doc clearly states : Perform a click on a link or a button, given by a locator.
public function click($link, $context = null)
There are also similar functions that do something similar, but not with the left mouse button
public function clickWithRightButton($cssOrXPath)
public function doubleClick($cssOrXPath)
This seems so trivial that I can't find anything about it. Why isn't there a clickWithLeftButton? Am I missing something here? I'm just starting with acceptance tests with CodeCeption.
I may not fully understand the question, but have you tried
$I->waitForText('Text User would click on Here', 30);
$I->click('Text User would click on Here');
Can anybody help me out clicking on particular static link on webpage without using QTP function?
I tried using WebLink after browse.page.WebLink then operation.
Not sure the reason you don't want to use QTP's click function, but you can try to hit the object at the DOM level with Browser().Page().Link().object.click (which really is the same as the B.P.L.Click method but at a lower level).
So I am trying to click a forgot password link (which causes a modal pop up) and confirm the pop up link so I can perform a test on the sent out email.
My code looks like this:
page.find(:css, '#launch-modal-link').click # code fails on this line, after clicking the link
page.driver.browser.switch_to.alert.accept # does not get to this line of code.
What am I doing wrong exactly when trying to click the "Ok" button in the modal pop up?
Do I need to add a try catch block (or whatever it is called in Ruby) around the link
Solved it - Found the answer somewhere else. Its a hack though, and not something done via cucumber directly.
page.evaluate_script('window.confirm = function() { return true; }')
This works because it over writes the confirm() to always return true and the confirm function seems to be a common javascript function to return the button clicked in a dialog box. Could be wrong about that. (read the javascript function being performed onclick. Might not always work)