Skip to content Skip to sidebar Skip to footer

How To Upload Attachments In Browser Tests Using Appium?

I am trying to automate a test case in Chrome where I would like to upload an attachment to an email. I use desiredCaps['browserName'] = 'Chrome'. While clicking attachments in ema

Solution 1:

Try this.If you are using ruby

This basically goes into the directory called screenshots and finds the second picture or the document that is visible inside the directory

find_element(id: "screenshots").find_element(class: "android.widget.ImageView[2]").clickend

This captures the first document/picture visible in the gallery

find_element(id: "").find_element(class: "android.widget.ImageView").click

You can modify it as per your requirement

Solution 2:

Solution 3:

In Java, you can use the below code to switch context.

Set<String> contextNames = driver.getContextHandles(); 
for (final String contextName : contextNames) { 
if (contextName.contains("NATIVE")) { 
driver.context(contextName); 
System.out.println("Switched to Native Context"); 
} 
}

in Python you can try something like this

contextNames = driver.contexts
for aContext in contextNames
if "NATIVE" in aContext:
driver.switch_to.context(aContext)

Post a Comment for "How To Upload Attachments In Browser Tests Using Appium?"