How i scroll screen in webview page with android calabash - scroll

I am using default feature to scroll down but that is just scrolled header instead of whole the screen. I want to screen remaining screen.

I) You can use swipe()
until element_exists("* marked:'selector'") do
scroll("ScrollView", :down)
end
II) You have to use evaluate_javascript for html component,
wait_poll(:until_exists => c) do
evaluate_javascript('webview',"$('selector').scroll();")
end

Related

Ionic 4 page animation page Div part move up words and down by click up arrow / down Arraow

Any one can help me in Ionic 4 am using the ionic page, In that page i have Div area (Please refer attachment image)
By clicking that Up arrow that div has to move Up Top of the page below up to below header part. By Cliking Down Arrow then that div back previous same position. How can be done ?
Any one can guide me how to solve this . Thank you
Stackoverflow is designed to solve your code/bugs related problems. Not to actually write the code for the application.
Use Ionic Animations.

verify scroller button works with preloaded data with watir-webdriver

I am trying to verify that a scroller button is working correctly. The button is an arrow image that slides a row of images/links, showing 5 out of the 10 images that are all loaded at page load. Whats making it difficult is that images are populated from a 3rd party provided so the urls change all the time. The only other identifier is by its class and text, the class is the same for all of them.
Since they are all loaded at the same time its hard to determine if the images are changing.
If you go to http://www.hayneedle.com/product/curiousgeorgepeelstickgiantmural.cfm and scroll to "Suggestions For You" you can see the on the right to scroll to a new set of suggestions. This button has broke before so need a simple way to regression it.
Any suggestions?
You can check if an image is actually visible to the user by using the present? method. You could also use the visible? method, but it throws an exception if the element does not exist. You can see a comparison of these and the .exists? method in the blog post, "Checking for an element – exists?, visible?, present?".
Knowing this, you could click the scrolling arrow and then check if last image is present (ie actually visible).
# Go to the page
browser = Watir::Browser.new :firefox
browser.goto 'http://www.hayneedle.com/product/curiousgeorgepeelstickgiantmural.cfm'
# This is the scroller control
scroller = browser.div(:id => 'HN_PP_RelatedCats')
# (optional) Check that the last image is *not* displayed
puts browser.div(:class => 'HN_Scroller_Cont').link(:index => 9).present?
#=> false
# Click the right scroller
scroller.div(:class => 'HN_Scroller_R').click
# Check that the last image is displayed
puts browser.div(:class => 'HN_Scroller_Cont').link(:index => 9).when_present.present?
#=> true
Note that the check for the last link/image is using when_present.present?. The when_present allows the scrolling to finish. Without it, you might end up checking the element before the scrolling is done (ie you false negative). The present? is there to return a true/false result.

how to scroll with selenium

I have here a challenge that I spent some time addressing.
Selenium tells me that it cannot click a link that is not visible, so that means I need to scroll my canvas? I am using ubuntu 10, firefox 3, selenium 0.1, ruby 1.9.2, and selenium-webdriver 2.5.0
My code is
driver = Selenium::WebDriver.for :firefox;
driver.get login_url
wait = Selenium::WebDriver::Wait.new(:timeout => 2)
wait.until {
driver.find_element(:name => 'j_password')
}
driver.find_element(:name => 'j_username').send_keys(username)
driver.focus(:name => 'j_username')`
and it says that focus() is not defined. How should I modify my code to put the input element on screen?
Um, this is a hypothetical example, I really need to scroll so that some other element is on the screen, but for simplicity I would like to be able to scroll s.t. any element is on the screen, even
location_once_scrolled_into_view to scroll using ruby.
As per your question your element is not visible, so selenium web driver is unable to click on it.
Simple solution to this is:
Store the xpath of the element which is visible and nearby to your element.
Scroll till that visible element, to make your element visible.
Ensure your element is now visible, click on it
eg code:
element = dirver.find_element(:xpath, "xpath of nearby visible element")
element.location_once_scrolled_into_view
my_element = driver.find_element(:xpath, "xpath of your element")
my_element.click
I had an element at the bottom of the page with no other element close enough to select first. Finally got around it by tabbing from the last field in the form on the page.
element.send_keys(:tab)
When the documentation says "not visible" it's not refering the view port, but to the status of the element on the page. If something is hidden with CSS it cannot be clicked.
If you want to scroll on the firefox window using selenium webdriver, one of the way is to use javaScript in the java code, The javeScript code to scroll down is as follows:
JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript("window.scrollTo(0,Math.max(document.documentElement.scrollHeight," +
"document.body.scrollHeight,document.documentElement.clientHeight));");
I'm not aware of ruby but the above code can be used as a java Script which will scroll down the whole page.You can even define the area you want to scroll in the view window by simply hard- coding the window.scrollTo(200,350);

Scrolling Facebook Canvas

I'm building a Facebook app. Facebook canvas type is FBML, then I put the fb:iframe inside the index page, load my ajax engine inside of that iframe, and after that, all content is updated trhough ajax. Sometimes the content pages can be long and requre the user to scroll down (with the main browser scrollbar). But when you click a link after scrolling down and the next content page is loaded, the scrollbar remains where it was (which makes sense), so you have to scroll back to the top.
I managed to solve this by forcing a scroll after the data is loaded. And it does get to the top of the div, but not to the top of the page, where the facebook bar is. I tried scrolling the parent window but thats not possible due to cross-site security restrictions.
I noticed that when you use the FB.ui (ie. to create a stream to publish) from within the same place where I load my content, it does scroll all the way to the top. So I guess maybe there's a FB api call to do that, but I cant find it.
Or maybe some way to force the browser to scroll all the way up no matter if you're at an iframe?
Any ideas?
UPDATE April 2011:
Facebook added the FB.CanvasClient.scrollTo method to their new JavaScript SDK. All you have to do now is:
FB.Canvas.scrollTo(0,0);
More info here: http://developers.facebook.com/docs/reference/javascript/FB.Canvas.scrollTo/
UPDATE April 2011: The following content is now outdated, but I'm leaving it here for reference purposes...
Are you using the new JavaScript SDK or the old one? With the old one, you can do this:
FB.CanvasClient.scrollTo(0,0)
Unfortunately, Facebook doesn't support the scrollTo() method with the new JavaScript API. I haven't tried this next technique with an FBML app, but I did have success with it using it in a Canvas iframe app (code borrowed from here: http://forum.developers.facebook.net/viewtopic.php?id=32906):
var x = 0, y = 0;
$("body").append('<iframe id="scrollTop" style="border:none;width:1px;height:1px;position:absolute;top:-10000px;left:-100px;" src="http://static.ak.facebook.com/xd_receiver_v0.4.php?r=1#%7B%22id%22%3A0%2C%22sc%22%3Anull%2C%22sf%22%3A%22%22%2C%22sr%22%3A2%2C%22h%22%3A%22iframeOuterServer%22%2C%22sid%22%3A%220.957%22%2C%22t%22%3A0%7D%5B0%2C%22iframeInnerClient%22%2C%22scrollTo%22%2C%7B%22x%22%3A' + x + '%2C%22y%22%3A' + y + '%7D%2Cfalse%5D" onload="$(\'#scrollTop\').remove();"></iframe>');
While the above technique will scroll the window to the top, I didn't find it 100% reliable. For example, it doesn't seem to work in Facebook's new Page iframe tabs. So I've resorted to using this 100% reliable technique, but unfortunately, it will only scroll to the top of the iframe:
Place this just below your opening tag:
<a id="top" name="top" style="display:block;height:1px;width:1px;"></a>
And the JavaScript that will do the scrolling;
window.location.hash = 'top';
window.location.hash = '';

jquery sliding tab "side effect"

I code this page, a tab with sliding capability : here
I really like the effect, but when you vien a long tab (let say specification), and we go to a smalll one (download) reclicking on a large one force the user to scroll down again...
Is it possible to jquery something that tell the page to stay scroll down at the max after the tab pressed ?
I'm doing something like this with the jQuery UI tabs, you can modify it for whatever layout:
//Tab panel height matching
$(".ui-tabs-panel").each(function() {
if ($(this).height() + 30 > $(this).parents(".subTabsC").height()) {
$(this).parents(".subTabsC").height($(this).height() + 30);
}
});
I have the whole tab content wrapped in a <div class="subTabsC">. The 30 pixels in my case is to account for the tabs and the border, adjust to whatever you need.
Yes. OnLoad you could iterate through all the tabs, find the tallest and set the container's height to that value and remove whatever's doing the smooth resizing.
It means some of the smaller things might look a little lost, but you'd not be resizing the page (which annoys me too).
couldn't you just add "return false" at the end of your function? this would prevent it from "refreshing" the page when you click the anchor link....I could be wrong...I'm just starting to learn jquery and javascript.

Resources