I am looking for the application of "onappear" along with click, wherein I want to click on the captured GUI once it appears.
I know this can be done using "wait" and then using "click", but then I have to statically feed in the wait time, which I wish to avoid.
Is there a way to use "onappear" and "click" together?
If not can somebody please come up with a solution to wait for a GUI and clicking it thereafter (dynamic wait)?
I can't think of a built-in solution, but you could write your own simple definition to do it. This doesn't use onAppear specifically, but I think it might accomplish your purpose.
In python:
def waitClick(myImage):
time = 0
while time < 30:
if not myRegion.exists(myImage):
wait(.5)
time += 1
else:
click(myImage)
break
This will check every half second for your image to appear, for 15 seconds. When it does appear, it will click the image, and then terminate the loop. Would something like this be helpful?
Related
I want to create a conveyor line where three cells do the same work in parallel to reduce the cycle time.
Workflow:
Workpiece carrier = WT: 12 pieces
3x cells
The WT should always be directed to the cell that is free or the work process is most likely to finish.
Since I have just started to get to learn about Anylogic, I am having a hard time setting the correct commands.
If someone has an idea of how to reach my goal I would be very grateful!
Review the implementation in the Solar Panel Production Line Example model inside the AnyLogic help, or download the source form the AnyLogic Cloud
https://cloud.anylogic.com/model/29d54a61-aaac-4c47-8e50-941c0f5bb36e?mode=SETTINGS
Easiest would be to use a select output and base the selection of the exit from the select output on the condition of whether one of the cells are busy or not
In your example, you need to replace the code of randomFrom(collection) with a function to check if a cell is busy or not. Since you don't have the cells in your example I cant give you the code. But try it yourself and if you cant manage after reviewing the example model then post a new question
I want to automate a simple task inside Facebook Ads Manager. This task involves setting up a campaign and uploading some ads. It can take a human 30 minutes to do this. However, they're doing the same thing every single time. Often with mistakes. It's something that should be automated. Done without human emotion or mistakes.
Facebook is very sensitive and I don't want it to ban me for the wrong reasons. So I need to feel human. I can take my time between clicks. However, the cursor movement itself needs to feel human. I only need to simulate a real human click for ethical purposes.
Say I get an element I want to move my cursor towards:
WebDriver driver;
// Set file path of chrome driver
System.setProperty("webdriver.chrome.driver", "C:\\chromedriver.exe");
// Create object
ChromeDriver driver = new ChromeDriver(options);
// Go to URL
driver.get("FACEBOOK URL");
// Get element
driver.findElement(By.xpath("//span[contains(text(), 'Setup Campaign')]");
What is the best way to move my cursor towards this element as a real human would?
A real human would first move the mouse. Not just click the element
They would move the mouse/cursor slowly. It could take up to say 500-1000 milliseconds. Certainly not instantly.
They would move the mouse/cursor in a curved fashion. Not just in a 100% straight line. Possibly, in a random fashion? So some elements of randomness may be needed?
I'm quite new to Selenium, so any input would be greatly appreciated.
I am writing my code in Java :)
WebDriver doesn't use an operating system input; it communicates directly with the browser via http protocol. If you want to simulate communication like a 'real' mouse input you have to use an automation solution that uses operating system based frameworks. In case of Windows you can use e.g.:
https://github.com/FlaUI/FlaUI (read https://github.com/FlaUI/FlaUI/wiki/FAQ to get the knowledge how to configure Chrome to expose web controls for FlaUI)
https://github.com/microsoft/WinAppDriver
I understand that this is not exactly what you asked, but in this case I recommend you to use the Facebook API instead of selenium.
It's more stable than your approach and without the risk of getting banned.
https://developers.facebook.com/docs/marketing-api/reference/v12.0
I'm a java beginner and I'm trying to program a robot that will fill a very annoying form for me.
Why is this form annoyin? Imagine I have to insert a thousand different values into this form but it only lets me insert one value at a time. Everytime time I insert each value I have to press an "OK" button and wait for the URL to update (this takes from 1 to 50s) and only so I'm able to insert another one.
To solve the problem I made a robot that uses a 1min delay between each "OK", but this is far from optimal, since when the URL updates in 1s the robot stays useless for a minute. Even worst, if the url takes more than 1min to update my robot is going to fill the form wrongly.
Is there anything I can do to detect when the url has updated and then use this information as the delay to my robot?
Thanks a lot!
One thing you could try is
Robot.getPixelColor(x,y)
which returns the color of a pixel on the screen. You can tell the robot to wait until the pixel is colored "correctly" (which would happen when the page is completely loaded).
You can use Selenium. It provides a good API and lots of tools for you to automate browser work. Some people might argue that this is not the purpose of the library, but I think that in your case it should work. Link: http://www.seleniumhq.org/download/
Why I think this is the solution:
Selenium is a suite of tools specifically for automating web browsers.
Which seems to be just what you are requesting.
P.S. There are third party drivers as well. For instance, you can download a driver for the Chrome browser.
At work I am using Ubuntu and at home I am using windows 7. I would like to know how can I benchmark my android application on Ubuntu and windows 7.
You can use DDMS and Systrace to break down what your app is doing and for how long.
As for "benchmarking," what do you mean by that? Do you want to see how long it takes to do something in your app?
It's usually more useful to just make sure you're doing things in the fastest way possible, rather than within a certain time window.
I wrote a code to specifically benchmark specific part of the code that I want. you can find it here:
http://farzad.devbro.com/android_benchmark/Devbro_Benchmark.java
Here is an example of the code to use:
Devbro_Benchmark.markStart("Label2"); //mark a begining
for(int i=0;i<1000;i++)
{
//you can create multiple markers at once. If you use the same marker name
//it will simply add up the times for you
Devbro_Benchmark.markStart("Label1");
//some random code
Devbro_Benchmark.markEnd("Label");
}
Devbro_Benchmark.markEnd("Label2"); // mark an ending
//once you are done with your markers you can display an extensive report which will be
//shown using the Log.d
Devbro_Benchmark.print_report();
//once you are done you can reset before redoing it.
Devbro_Benchmark.reset();
There are now two Jetpack benchmarking libraries. from the Android team.
Macrobenchmarking: Allows you to benchmark entire workflows
Microbenchmarking: Enables benchmarking specific code in isolation.
I'm using Marthon to run tests on a Java Swing application. I build the base tests by recording, then just make small modifications to the resulting Ruby tests to tweak it to fit what I need. I've run into an interesting problem where comboboxes selections do not work. For example, it'll record...
select("Value", "0.25")
...for the Value combobox, which has a valid option of 0.25 in it. However, during playback, the script pauses execution at that point. If I manually click on the combobox (just to drop it down, not actually selecting anything), then the script will select the right number and continue on.
The problem exists for ALL (so far tested) comboboxes in my application, but none of the other control types. Is there a way to select a value in the combobox that works? I don't mind tweaking the recorded script, I just want to not have to manually click on all my comboboxes each time they're in the script!
Have a look at the object map files for the window and change the recognition properties. That should make this consistent.
The _2 basically means that Marathon is unable to find unique properties to identify the components.
Well, I figured it out already... Apparently the recorder just does a poor job at figuring out the correct label for comboboxes. I was able to get some to work by removing the "_2" or whatever at the end. Others, it took incrementing that number. So, apparently the way the recorder sees the screen layout is different from what the player sees.
edit
The newest version of Marathon appears to have fixed whatever was ailing it before. I'm now unable to duplicate the problem.