Selenium run into CI open a component as mobile - java

I need some help.
I'm running some Selenium test into our CI pipeline (we use travis).
One of my test failed only on the CI, on my local machine everything is fine.
I get this error message:
org.openqa.selenium.ElementNotInteractableException: element not interactable
My test click on an input and just sendkey the new time
wait.waitForLoading();
WebElement start = driver.findElement(By.xpath("//*[#data-testid='keyboardTimePicker.dailyStartTime']//input"));
start.click();
start.sendKeys(startime);
on this part we have also the possibility to use a clock picker but I prefer to send the time into the input.
But on this specific part on the CI it's open the clock picker, no the one from desktop version but the one from mobile version, it's like on the CI it's thinking we are in the mobile version (maybe because we don't have cursor?). The window is opened in fullscreen and I tried also with specific size but nothing change.
Do we have some possibility to force desktop version?

Related

Pick a file using native Windows picker on a Jenkins master (headless) node

I have Selenium test which picks a file via native Windows file picker window. This is achieved by using Java Robot class. This works fine when the test runs with a normal session (i.e. with a GUI). However when running test on a Jenkins master node tests are performed from other user and there is no active desktop session in this case, and files cannot be picked.
Is there a way to deal with this without setting slave node with a GUI?
There are lot of articles which suggest all the same ways to deal with file picking, but none mention about dealing with Windows native file picker when running a test from master node (with different user).
Robot can't be used in a headless environment. It's a known limitation. So you have to use active desktop mode. The same is valid for tools like SikuliX / AutoIT.

Appium/TestNG script on AWS device farm - could not find element

I am setting up my Appium/TestNG script in java on AWS Device Farm, using the tutorial: http://docs.aws.amazon.com/devicefarm/latest/developerguide/test-types-android-appium-java-testng.html
After I compile and upload the 'zip-with-dependencies.zip' to AWS Device Farm and run the tests on a device, I get an error, that the first clickable element in the script could not be found.
So the Setup and Teardown suite are passing in the run, but the actual test fails every time:
Failure Description on AWS Device Farm
My question is am I missing something from the configuration or is the script in need of any extra desired capabilities in order to actually execute the test on AWS Device Farm?
I changed the version of the tested app with another one, seems like the previous one, where the element could not be found was popping out an android system message, which could not be clicked with the provided code, hence the searched element could not be found.
Another thing that device farm is not so good at - providing real time observations on the running tests, which could save a lot of time in this situations.
Answering this for people who are still facing this issue.
You have to set up the automationName desired capability to the automation mechanism that you are using to automate the tests.
For me setting it up to uiautomator2 works.
capabilities.setCapability("automationName", "uiautomator2");
Two suggestions:
1. Set element waiting time to be less than 60 seconds, because default Appium session will timeout after that.
2. Create a screenshot for the failure, check whether the element was loaded correctly.
Hope this would help:)
Thanks,
Hongda

Error: When i minimize Internet Explorer which is running the automated WebDriver Code

I have written the Selenium webdriver java code to automate the test and its working fine. But I have lot of data input to test my web and it takes time. So when i minimize the IE to do some other task while it is running the automation, it is throwing error:
org.openqa.selenium.ElementNotVisibleException: Element is not displayed
Selenium WebDriver is trying to simulate "real" users interaction with the webpage. If a person can't click on a button not currently displayed, neither can Selenium.
ElementNotVisibleException occurs when the element you want to interact with is not displayed. When you minimize the browser some of the elements are no longer visible, even though they where in maximized window.
You can add scroll using moveToElement() from Actions class every time you want to perform any action (I don't recommend it, you increase significantly the chance for errors), or find another hardware solution, like plugging in another screen, run the test on another computer etc.
According to my experience, the Internet Explorer WebDriver is very oversensitive when it comes to disturbances from a real user while running test cases. It's better to not touch anything at all. ;-)
Try Chrome! This is much more robust and also faster.
Selenium script runs as a simulator. You cannot do another work when script is running. Chrome is fast but while running script in chrome you can not do other task like any other browser. If you minimize window, you will get exception "ElementNotVisible".

How to get browser window front while running the test using selenium webdriver?

I'm currently running my selenium webdriver tests in 2 browsers (studentdriver and tutordriver)
studentdriver = new ChromeDriver();# opening student in chrome browser
tutordriver = new FrefoxDriver();#opening tutor with firefox browser
and I'm student browser first and then tutorbrowser soth that student browser will be behind and tutorbrowser will be on front side. when script running with studentbrowser, it will automatically comes fron and tutorbrowser will be back side but when script start running using tutorbrowser it is not coming front side and it is creating some problem in between.
I need a solution to get tutorbrowser front when script start running on tutorbrowser.
Note: I should not close studentbrowser because I'm closing both the browsers in #After
((JavascriptExecutor) driver).executeScript("window.focus();");
try this with each driver.
Unfortunatly, this is an OS problem. It's up to the window manager to handle the ovelapping, tiling, organisation of the windows, which you can't control directly from your code.
The best bet you'll have is to launch a Sikuli Robot with which you'll be able to bring back the correct window. It's a bit of work, though, to include in your tests, but it can be used from Java with no problem
See the beast at http://www.sikuli.org

selenium server launching two test execution tabs in firefox

So as the title suggests, when launching my HTML suite with a custom firefox profile (also with multiwindow), the server is launching two tabs, both trying to execute the test, targetting the same single window the actions are being carried out in. If I close one of the selenium tabs, the test will then complete successfully.
The custom profile is a profile created in firefox 19.0.2 and I am now running it in 20.0
Now If I update up the custom profile to coincide with the latest version of firefox, this fixes the tab issue when launching the test...however my question is....
Does anybody know the cause of this behaviour?
Many thanks,
Joe
I think Firefox opens the second tab because the current milestone of the browser software does not match the value of the setting browser.startup.homepage_override.mstone in prefs.js: The browser tries to show sort of a successful-update-page in a new tab.
According to https://bugzilla.mozilla.org/show_bug.cgi?id=102313
you can suppress this behaviour by manually setting browser.startup.homepage_override.mstone to ignore. For me, this single change in prefs.js did the trick.
halfbit

Categories

Resources