I am having issues trying to use the swipe functionality on the ios app. Currently using Appium v1.3.5 in conjuction with Cucumber/RubyMine v7.04.
I have tried using a range of x, y co-ordinates. However I am still only able to swipe half way and unable to click on the element on screen.
Has anyone come across this issue before?
def self.hide_thread
action = Appium::TouchAction.new
action.press(x: 360, y: 70).move_to(x: 0, y: 70).release
sleep(1)
find_element(:xpath,"//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]/UIAButton[1]").click
end
Please error message:
elementId 18 could not be tapped(Selenium::WebDriver::Error::UnknownError)
./features/step_definitions/hidden_threads.rb:82:in `hide_thread'
./features/step_definitions/hidden_threads.rb:102:in `/^Hide the thread$/'
features/hidden_threads.feature:8:in `And Hide the thread'
Then Thread will be hidden # features/step_definitions/hidden_threads.rb:105
for java I found this solution! you try for ruby to pass deltax and deltay instead of end point coordinates and update this answer if needed.
Check This answer
swipe(100,200,10,20,300) => swipe starting from Point (100,200) and end at Point (110,220) which means finger would move Right lower side fro current position
swipe(100,200,-10,20,300) => swipe starting from Point (100,200) and end at Point (90,220) which means finger would move Left lower side from current position
swipe(100,200,10,-20,300)=> swipe starting from Point (100,200) and end at Point (110,180) which means finger would move Right Upper side from current position
swipe(100,200,-10,-20,300)=> swipe starting from Point (100,200) and end at Point (90,180) which means finger would move Left Upper side from current position
Related
I want to create a View very similar To the iOS notes application. The main function is to allow the user to get a check box in front of a line of Text.
My first attempt is this:
I have a UITextView where i try to insert buttons on the left side of the View, the Problem is i dont get the right y Position for each line and the whole text is offsetted even if there is no Button in Front of the line.
Question:
Is there a better approach, maybe much simpler or even built in functionality in UITextView i couldnāt find?
If not, how do i get the exact y position of the line the cursor is currently in, so i can set the Buttons in the correct positions?
I am trying to tap on a link within a link label. Using the recorder I have this code for the tap event
let link = XCUIApplication().scrollViews.otherElements.links["link here"]
link.tap() does not tap on the link correctly. The link is at the end of the text, how would I be able to tap that part of the label? It seems like XCUITest taps the start of the text which doesnt have the link
Seems like it may be an accessibility container issue. However one work around is to compute the coordinate relative to the UI element you can access with XCUIApplication.
let coordinate = CGVector(dx: 0.1, dy: 0.1) //Enter your values for x / y
someElement.coordinate(withNormalizedOffset: coordinate).tap()
I usually just use trial and error to compute the coordinates. However, you can use the accessibility inspector and debug prints if you need an extra precise press.
I'm looking for a way to draw a rectangle in a single drag movement, so the user click and hold the mouse pressed then move the mouse and the rectangle is painting as he go and the drawing is finished when he stop pressing the mouse.
Currently it's done using mouse click -> drag -> mouse click again to finish, not that intuitive.
I'm using the latest OpenLayers 3.
Thanks!
The functionality asked for is already present in latest openlayers version (v3.19). Use ol.interaction.Draw.createBox() to create a rectangle with 2 clicks one for start and another for end. See the below example for more details
http://openlayers.org/en/latest/examples/draw-shapes.html?q=draw
You can create your style for the rectangle by creating style object and declaring it in ol.interaction.Draw().
Instead of using the built-in interaction use an instance of https://github.com/openlayers/ol3/blob/master/src/ol/interaction/dragzoom.js but pass in an option/condition to not use the shift key. Here are the conditions https://github.com/openlayers/ol3/blob/master/src/ol/events/condition.js
Have you looked into the DragBox interaction? This will give the user an outline of the box as they are drawing it with click, drag, and release being the interaction.
Thanks in advance for any help. I'm a Noob at actionscript 3, and what I'm trying to do is make a image slider. Basically, there would be a movieClip, acting as a container, and a left and right button. when I click left button, the Container slides left and vise versa.
Now I kind of got things working, the problem is when I press say the left button, the Container moves left,and keeps moving left as many times as I click the left button. But I want it to stop, or loop, at the end of the Container, and I'm not quiet sure how to do this.
I searched all over the net but didn't find anything useful, most of what I found is really complex or heavily reliant on external libraries, and I don't want to just copy and paste code snippets that I don't understand. Can anyone please give alittle insight on how this can be accomplished in actionscript 3.
here is a copy of my code so far
Thanks
-Noob
//leftButton and rightButton are movieClips on the stage
leftButton.addEventListener(MouseEvent.MOUSE_DOWN, moveLeft);
rightButton.addEventListener(MouseEvent.MOUSE_DOWN, moveRight);
//NOTE: thumbContainer is a movieClip on the stage
//Make the mask;
var myMask:MovieClip = new MovieClip();
this.addChild(myMask);
myMask.graphics.beginFill(0x000000);
myMask.graphics.drawRect(6,138,534,144);
myMask.graphics.endFill();
thumbContainer.mask = myMask;
//thumbContainer moves left on button press
function moveLeft(evt:Event):void
{
thumbContainer.x -= myMask.width;
}
//thumbContainer moves right on button press
function moveRight(evt:Event):void
{
thumbContainer.x += myMask.width;
}
Now I kind of got things working, the problem is when I press say the left button, the
Container moves left,and keeps moving left as many times as I click the left button. But I
want it to stop, or loop, at the end of the Container, and I'm not quiet sure how to do
this.
What you have mentioned here is not very clear. From what I understand, you have a container myMask which slides off your parent container thumbContainer when you repeatedly press the left (or right) button.
Assuming this is the problem, allow the myMask container to move left or right, but check each time with the screen resolution width (Maybe have a if statement or something). Hence, move left/right only when the condition is satisfied(there is space for moving left/right)
Hope that helps!
How do I check if the Left button of my mouse is currently pressed down/dragging something(I preffer the first possibility).
I tried Mouse.IsDraging,but no result.
NOTE: I handle mouse messages in my application so its no problem if its a WM,just share a way to accomplish my task.
There is a Windows API function GetAsyncKeyState(), which despite its name is also usable to get the state of the mouse buttons. The linked documentation directly contains the answer to your question:
The GetAsyncKeyState function works with mouse buttons. However, it checks on the state of the physical mouse buttons, not on the logical mouse buttons that the physical buttons are mapped to. For example, the call GetAsyncKeyState(VK_LBUTTON) always returns the state of the left physical mouse button, regardless of whether it is mapped to the left or right logical mouse button. You can determine the system's current mapping of physical mouse buttons to logical mouse buttons by calling GetSystemMetrics(SM_SWAPBUTTON) which returns TRUE if the mouse buttons have been swapped.
The result type is short, to check for the most significant bit just test whether the value is negative.
OnMouseMove(UINT nFlags, CPoint point)
{
m_LButtonPressed=nFlags & MK_LBUTTON;
CWnd::OnMouseMove(nFlags, point);
}