Appium+android+selenium switch - android-activity

I have login scenario in which when the user click on the signin button then the next activity is opened in which there is a list. i am new to appium and find it hard how to get the validation that the login is successfull.
I didnt got success with the below
driver.switchTo().window((String)driver.getWindowHandles().toArray()[windowIndex]);
please guide how to get the current activity & move to awaiting activity, so that i can validate the object existance.

Can you just share the screenshot of the next activity and while launching your apk file with the starting activity name , there is no further need to specify the next activity names. Appium will run the next concurrent activitiesby itself.

Related

Flutter login i want to stop the loop

enter image description here
Login with google is working and logging in but this loop starts when i don't want to login how can i stop it.
It happens because you use RoundedLoadingButton package. But if you want to stop it when you have an error you can call googleController.stop();

E2E test Protractor issue: redirect to another page in the same window

The website I need to test requires login. However, you have to stay in the same window to keep your login information, which means if you close the window of this page, you need to login again. This gives me the problem: when I am using protractor to test the websites, it seems like each time I use browser.get(url). It will turn off the browser and open another one for the test, then I lost my login information. So I can't test the pages I want to test. Can anybody give me some suggestions, I have not figured it out for one days. Crazy!
describe('Sample List page test', function(){
beforeEach(function(){
browser.driver.get('http://localhost:8600/#/login');
browser.driver.sleep(2000);
browser.driver.findElement(by.id('google-login')).click();
});
it('should list all the items in samples',function(){
browser.get("#/osctr/sample");
expect(browser.getTitle()).toBe("Sample");
}
});
});
In the above codes, I can't get information in the sample page because I used brower.get(url), it will open a new page which I will lose my login information.
When you do browser.driver.get(), it would open a new windown. That's how selenium-webdriver works. There was an issue opened longtime back to attach webdriver instance to an existing browser window which is now marked as NotFeasible.
If you want to keep the browser session intact, you can do browser.driver.get() in before() method instead of beforeEach() and have multiple tests that work on the same browser instance and quit the browser in after method.

While recording the script, scripts records the command like "click id=ui-id-25"

I am recording the site of online ticket booking and while recording the script, scripts records the command like "click id=ui-id-25". Once I finish recording the script and click on play to run current test case. I get error message like 'Element id=ui-id-25 not found'.
So please let me know what's the meaning of the command 'click id=ui-id-25' and why its recorded, even though while running the script we get error message.
The meaning of the command
The command click id=someId tells Selenium to simulate the click on the element on the page which has id = "someId". If there is no element with this id on the page at the time of execution of this command; we have the error telling that Element ... not found !.
Why it's recorded
Selenium IDE records actions you do in the page. Clicking an element of the page is an action so it's recorded.
Why we get this error
This is actually because Selenium IDE doesn't record "waiting time". If, while recording, you do action 1 and wait for an element to be shown (even for 0.5 second) and then click on this element. For Selenium, this is only two actions :
doing action 1
clicking the element
and so when running the test case, it try to click the element directly after doing the action 1 without waiting. In this case, it doesn't find the element and gives the error !
Okey, what is the solution ?
One simple solution is to add the command waitForElementPresent to wait for the element to be present on the page before clicking it. You can do that while recording the test case right click on the element and selecting this command before clicking on it. Or you can add it to the test case when seeing this error. Add it just before the click command causing the error and give it the same argument as the click ( ie. id = ui-id-25 in your case)
Hope this answers your questions

How can i generate a message in selenium IDE for user to do a particular action?

when i play my test script then it stops at a page. Is there any command to generate a message to the user to click on the button to proceed to the next page.
you can display you message in an alert window
command:open
Target:/
command:click
target:btnAlert
command:assertAlert
target:I’m blocking!
command:verifyTextPresent
target:Alert is gone.
then continue rest of your test cases

Publishing a story using Facebook open graph

I am currently trying to run through the publish open graph story for iOS tutorial on the Facebook website.
https://developers.facebook.com/docs/tutorials/ios-sdk-tutorial/publish-open-graph-story/
I'm getting lost at step 2 - Set up your back end server. I have set up a Heroku account just like it says and I go through the set up tutorial on the Heroku site. It all seems fine. I save the code listed in step 2 in a new file I created called opengraphobject.php (I have no idea if this was the right thing to do?).
After that it says "Once you've uploaded the dynamic object creation code, test a sample object using the Object Debugger. Enter a URL into the debugger, for example:"
https://fbsdkog.herokuapp.com/repeater.php?fb:app_id=233936543368280
&og:type=fb_sample_scrumps:meal
&og:title=Pizza
&og:description="Pizza"
&og:image=https%3A%2F%2Fs-static.ak.fbcdn.net%2Fimages%2Fdevsite%2Fattachment_blank.png
&body=Pizza
I have no idea what I'm supposed to do at this point. My action is called beats and the object is called boss. How do I generate a url like this for my own action?
I can't move onto stop 3 till I move past this because it's very similar.
The page opengraphobject.php should contain the sample code provided in that step.
So when you are done setting it up you point to your url in the debugger to test
https://YOUR.herokuapp.com/opengraphobject.php?fb:app_id=YOUR_APP_ID
&og:type=fb_sample_scrumps:meal
&og:title=Pizza
&og:description="Pizza"
&og:image=https%3A%2F%2Fs-static.ak.fbcdn.net%2Fimages%2Fdevsite%2Fattachment_blank.png
&body=Pizza