Play alert sound (same as default message ringtone)

Yes it is possible, but they use undocumented enum values, that means you should not use it on AppStore apps. AudioServicesPlaySystemSound(1003); iOS SDK does not bundle these sound files, but you can find them on the device in the /System/Library/Audio/UISounds/ folder. However, I believe these files are copyrighted. Why not create a sound yourself?

Twitter Bootstrap alert message close and open again

Data-dismiss completely removes the element. Use jQuery’s .hide() method instead. The fix-it-quick method: Using inline javascript to hide the element onclick like this: <div class=”alert” style=”display: none”> <a class=”close” onclick=”$(‘.alert’).hide()”>×</a> <strong>Warning!</strong> Best check yo self, you’re not looking too good. </div> <a href=”#” onclick=”$(‘alert’).show()”>show</a> http://jsfiddle.net/cQNFL/ This should however only be used if you are lazy … Read more

Animate a custom Dialog

I’ve been struggling with Dialog animation today, finally got it working using styles, so here is an example. To start with, the most important thing — I probably had it working 5 different ways today but couldn’t tell because… If your devices animation settings are set to “No Animations” (Settings → Display → Animation) then … Read more

How to handle login pop up window using Selenium WebDriver?

Use the approach where you send username and password in URL Request: http://username:[email protected] So just to make it more clear. The username is username password is password and the rest is usual URL of your test web Works for me without needing any tweaks. Sample Java code: public static final String TEST_ENVIRONMENT = “the-site.com”; private … Read more

Check if any alert exists using selenium with python

What I do is to set a conditional delay with WebDriverWait just before the point I expect to see the alert, then switch to it, like this: from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.common.exceptions import TimeoutException browser = webdriver.Firefox() browser.get(“url”) browser.find_element_by_id(“add_button”).click() try: WebDriverWait(browser, 3).until(EC.alert_is_present(), ‘Timed out … Read more

Why is console.log() considered better than alert()?

alert() is blocking alert() cannot be easily suppressed in non-debug environment console typically formats your objects nicely and allows to traverse them logging statements often have an interactive pointer to code which issued logging statement you cannot look at more than one alert() message at a time consoles can have different logging levels with intuitive … Read more

How to change theme for AlertDialog

In Dialog.java (Android src) a ContextThemeWrapper is used. So you could copy the idea and do something like: AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(this, R.style.AlertDialogCustom)); And then style it like you want: <?xml version=”1.0″ encoding=”utf-8″?> <resources> <style name=”AlertDialogCustom” parent=”@android:style/Theme.Dialog”> <item name=”android:textColor”>#00FF00</item> <item name=”android:typeface”>monospace</item> <item name=”android:textSize”>10sp</item> </style> </resources>