Iam a beginner in EarlGrey. Before i used them, I used swift. Now, is my problem I have a while loop, I don't know how I can make a while loop in EarlGrey.
I want this while loop written in EarlGrey :
if XCUIApplication().otherElements[XYZ].exists { while !XCUIApplication().buttons[Button].exists {
XCUIApplication().otherElements[XYZ].swipeLeft() }
XCTAssertTrue(XCUIApplication().buttons[Button].exists, "Button not exist!") XCUIApplication().buttons[Button].tap()
}
Thanks a lot!
if existAccessibilityID(AccessibilityIdentifier: "XYZ") {
EarlGrey.select(elementWithMatcher: grey_accessibilityID(Button)).usingSearch(grey_swipeFastInDirection(GREYDirection.left), onElementWith: grey_accessibilityID(PageViewController)).perform(grey_tap())
}
Ok, I have found a solution...
Related
So I'm trying to make a keyboard handler for a side project that I'm making in SDL2. After searching around the web a bit for some help this is what I came up with.
bool Keys[322];
void init() override {
for (bool i : Keys) {
i = false;
}
}
void update() override {
if (CRS::event.type == SDL_KEYDOWN) {
Keys[CRS::event.key.keysym.sym] = true;
}
if (CRS::event.type == SDL_KEYUP) {
Keys[CRS::event.key.keysym.sym] = false;
}
if (Keys[SDLK_w]) {
Transform->Velocity.y = 0; //moves the player up
}
}
This code above works fine most of the time, but the problem occurs whenever I try to use any keys SDL considers a modifier (such as left shift, capslock, ctrl, alt, etc). Whenever I even touch one of those buttons I get a Access violation reading location error. Can anyone tell me why that is? And if I wanted to use shift, capslock, etc how would I go about doing that?
So i've decided to scrap my code after realizing that this probably isn't how I want to implement what I wanted and used the SDL_GetKeyboardStates function instead, which worked like a charm.
I tried implementing an RTS in unreal engine c++ and currently I can select and deselect units but they won't move though I already have a function for that. Could someone take a look what I am doing wrong? Here's my code:
void ACoba_PlayerController::SetupInputComponent()
{
Super::SetupInputComponent();
InputComponent->BindAction("RightMouseClick", IE_Pressed, this, &ACoba_PlayerController::MoveReleased);
}
void ACoba_PlayerController::MoveReleased()
{
if (SelectedActors.Num() > 0)
{
for (int32 i = 0; i < SelectedActors.Num(); i++)
{
FHitResult Hit;
GetHitResultUnderCursor(ECC_Visibility, false, Hit);
FVector MoveLocation = Hit.Location + FVector(i / 2 * 100, i % 2 * 100, 0);
UAIBlueprintHelperLibrary::SimpleMoveToLocation(SelectedActors[i]->GetController(), MoveLocation);
}
}
}
Note: I've already setup the input for RightMouseClick at the input property.
Could someone help me please. Thank you.
Make sure you have set your PlayerController to receive input:
ACoba_PlayerController::ACoba_PlayerController()
{
AutoReceiveInput = EAutoReceiveInput::Player0;
/* ... */
}
I just tested the right button and it worked.
I'm using Unreal 4.24.2
I had the exact same issue, and after spending a day into it, i found out the problem is not in the code itself (mine is identical than the OP), the problem was that you need to add in your map a NavMeshBoundVolume in UE editor, this will make your map floor surface "walkable" by your actors, without this the SimpleMoveToLocation function won't do anything.
I found it very annoying that there is no warning or error displayed showing that you are missing a NavMeshBoundVolume, that would save a lot of time.
this.BrandSetup = function (BrandName, URL, BrandDescription) {
browser.isElementPresent(brandListingPagePo.box_AddNewBarnd).then(function (result) {
if (result) {
brandListingPagePo.box_AddNewBarnd.click();
}
}
}
I am calling this function three times for the first time it does not work maybe because of the (.then) promise is not resolved for the second and the third time it works fine.
Thanks in advance
What you're doing now doesn't work because it enters the function, sees that the element is not visible, then exits right away.
Use can use Protractor Expected Conditions to wait till the element is clickable before clicking it .
this.BrandSetup = function (BrandName, URL, BrandDescription) {
const EC = protractor.ExpectedConditions;
browser.wait(EC.elementToBeClickable(brandListingPagePo.box_AddNewBarnd)).then(function() {
brandListingPagePo.box_AddNewBarnd.click();
}
}
Alright so here is my code. This should be really simple but it doesn't want to work with me for some reason. Raycast sends a ray from the mouse, if it hits an object with a tag, it assigns a number to a variable. If it doesn't hit an object, then it sets the variable as -99. For some reason mine is hanging on:
A. I don't hit the objects, it outputs -99 the first time but after that it hangs on getting assigned 4.
B.I hit the objects and it will work just fine. After I click OFF the objects it hangs on the variable from the object I just hit previously.
em.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GameFunctions : MonoBehaviour {
int Hitnum = -99;
void Start () {
}
void Update () {
if (Input.GetMouseButtonDown (0)) {
objectCheck ();
}
}
//end of UPDATE function
public void objectCheck () {
RaycastHit hit;
Ray ray = camera.ScreenPointToRay (Input.mousePosition);
if (Physics.Raycast (ray, out hit, 10000.0f)) {
if (hit.collider.tag == "Box") {
Hitnum = 1;
} else if (hit.collider.tag == "Sphere") {
Hitnum = 2;
} else if (hit.collider.tag == "Pyramid") {
Hitnum = 3;
} else if (hit.collider.tag == "Trapezoid") {
Hitnum = 4;
} else {
Hitnum = -99;
}
}
Debug.Log (Hitnum);
}
//end of check
}
Thanks in advance. This is driving me nuts because it should be simple.
EDIT: posted full code this time, yes all of it. I should mention that there are no other objects with tags, it's just null space. This was supposed to be a very basic shape identifier for kids.
EDIT:EDIT: I expect it to put out -99 if you do not hit the object. Later I will probably do something with the numbers but right now I jest need to fix this.
Restarted unity, everything works fine now. Thanks. Looked through my settings to see what had changed. I earlier deleted the background that had a background tag on it. I guess unity decided that if there is not hit on raycast, it will get the object that it last hit?
Sorry if this sounds quite trivial. I am just not getting it. How can one determine if a particular sprite is already in a layer? Basically, I need to check this before determining whether to add it to the layer or not.
if ( [ myNode.children indexOfObject:sprite ] == NSNotFound ) {
// you can add the code here
}
There's so many ways:
1) try to get child
if (![layer getChild:sprite]) {
// Your code
}
2) try to get child by tag
if (![layer getChildByTag:spriteTag]) {
// Your code
}
3) Check if sprite is on children array (like #oopology answer)
if ([layer.children indexOfObject:sprite] == NSNotFound) {
// Your code
}