I am working in Ranorex Studio 6.0.1 and have recorded a web browser automation test for file upload. During the run, upload button was not clicked on first attempt. I am planning to write C# code to ensure whether it is clicked or not. If it was not clicked, I want to click the button again. But the .cs file for the recording is locked and I don't know how to handle this using user code.
I am new to user code actions. Please help me to add user code for the same.
Regards,
Pandi
Adding C# code to handle file upload window
-
- Posts: 5
- Joined: Thu May 27, 2010 8:03 am
Re: Adding C# code to handle file upload window
Hi,
I would recommend you to read this User Guide chapter about creating User Code actions:
http://www.ranorex.com/support/user-gui ... tions.html
Basically, you need to create new user code action at a place, where you want to solve your problem. Anyway, instead of creating a workaround for failed click, you should investigate the reason why the click fails
I would recommend you to read this User Guide chapter about creating User Code actions:
http://www.ranorex.com/support/user-gui ... tions.html
Basically, you need to create new user code action at a place, where you want to solve your problem. Anyway, instead of creating a workaround for failed click, you should investigate the reason why the click fails
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: Adding C# code to handle file upload window
Yeah, I agree with Pavel. The issue here is that your click isn't working the way you expected it to. That won't change just because you move the action to user code.
It is most likely a timing issue. Try to add a Delay action right before the click and see if that fixes it. If it does, then we know for sure it's timing. You can then work on making the xpath better or adding a WaitForExist action in place of the Delay (try not to use too many delays in your tests as they are not 'smart' and just wait the given time, while WaitFor(Exist/NotExist) are smarter and better for long-term test maintenance).
It is most likely a timing issue. Try to add a Delay action right before the click and see if that fixes it. If it does, then we know for sure it's timing. You can then work on making the xpath better or adding a WaitForExist action in place of the Delay (try not to use too many delays in your tests as they are not 'smart' and just wait the given time, while WaitFor(Exist/NotExist) are smarter and better for long-term test maintenance).
Shortcuts usually aren't...