How to handle Alert box / Pop up using JAVA for Android?


#21

Hi,
I have the same issue about not being able to select alerts on different Android fragments. Can you please specify a method other than below?

  1. driver.switchTo().alert();
  2. driver.elementByXPath
  3. driver.elementById

I tried all of these options and still did not get a result in the following structure:

<android.widget.FrameLayout>
<android.widget.LinearLayout>
	<android.widget.FrameLayout resource-id="android:id/content">
		<android.widget.LinearLayout>
			<android.widget.ImageView resource-id="xx/iv_custom_alert_icon">
			<android.widget.TextView resource-id="xx/tv_custom_alert_title">
			<android.widget.TextView resource-id="xx/tv_custom_alert_subtitle">
		<android.widget.LinearLayout>
			<android.widget.TextView resource-id="xx/v_custom_alert_positive"> 

alternative suggestions would be appreciated, thanks.