Web driver wait not working(Urgently solution required plzz) .element is clickable


#1

Hi all…m trying to locate elements in iOS and for none of them its working using this-

WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.visibilityOf(element));

Appium version- 1.6.1
Java client - 5.0.2
xcode- 9.2 or 9.4

n whole method is this-

public boolean validateForElementDisplayed(WebElement element,WebDriver driver,ExtentTest test, String stepDesc, String inputValue, String expectedValue, String actValue) throws Exception
{

	boolean check=false;

	try{

		WebDriverWait wait = new WebDriverWait(driver, 10);
		wait.until(ExpectedConditions.visibilityOf(element));
		passNew(stepDesc, inputValue, expectedValue, test);
		check=true;


	}
	catch (Exception e) {

		check= false;
		System.out.println(stepDesc+" fail");
		failNew(driver, stepDesc, inputValue, actValue, test);
	}
	return check;
}

if u wanna see pom then-

	<dependency>
		<groupId>com.google.guava</groupId>
		<artifactId>guava</artifactId>
		<version>21.0</version>
	</dependency>

	<!-- https://mvnrepository.com/artifact/org.testng/testng -->
	<dependency>
		<groupId>org.testng</groupId>
		<artifactId>testng</artifactId>
		<version>6.14.2</version>
	</dependency>

	
	<!-- https://mvnrepository.com/artifact/io.appium/java-client -->
	<dependency>
		<groupId>io.appium</groupId>
		<artifactId>java-client</artifactId>
		<version>5.0.2</version>
	</dependency>

	<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
	<dependency>
		<groupId>org.apache.poi</groupId>
		<artifactId>poi</artifactId>
		<version>3.11</version>
	</dependency>

	<dependency>
		<groupId>org.apache.poi</groupId>
		<artifactId>poi-ooxml</artifactId>
		<version>3.11</version>
	</dependency>

	<dependency>
		<groupId>com.google.code.gson</groupId>
		<artifactId>gson</artifactId>
		<version>2.2.4</version>

	</dependency>

	<dependency>
		<groupId>com.googlecode.libphonenumber</groupId>
		<artifactId>geocoder</artifactId>
		<version>2.1</version>
	</dependency>
	<dependency>
		<groupId>com.google.code.geocoder-java</groupId>
		<artifactId>geocoder-java</artifactId>
		<version>0.16</version>
	</dependency>

	<dependency>
		<groupId>com.google.api-client</groupId>
		<artifactId>google-api-client</artifactId>
		<version>1.23.0</version>
	</dependency>

	<dependency>
		<groupId>org.apache.httpcomponents</groupId>
		<artifactId>httpclient</artifactId>
		<version>4.5.5</version>
	</dependency>

	<!-- https://mvnrepository.com/artifact/commons-httpclient/commons-httpclient -->
	<dependency>
		<groupId>commons-httpclient</groupId>
		<artifactId>commons-httpclient</artifactId>
		<version>3.1</version>
	</dependency>


	<!-- https://mvnrepository.com/artifact/com.relevantcodes/extentreports -->
	<dependency>
		<groupId>com.relevantcodes</groupId>
		<artifactId>extentreports</artifactId>
		<version>2.41.2</version>
	</dependency>
	<dependency>
		<groupId>com.googlecode.json-simple</groupId>
		<artifactId>json-simple</artifactId>
		<version>1.1</version>
	</dependency>
	<dependency>
		<groupId>org.hamcrest</groupId>
		<artifactId>hamcrest-all</artifactId>
		<version>1.3</version>
		<scope>test</scope>
	</dependency>

	<!-- https://mvnrepository.com/artifact/net.avh4.util/imagecomparison -->
	<dependency>
		<groupId>net.avh4.util</groupId>
		<artifactId>imagecomparison</artifactId>
		<version>0.3.2</version>
	</dependency>






</dependencies>

<build>


	<plugins>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-compiler-plugin</artifactId>
			<version>3.7.0</version>
			<configuration>
				<source>1.8</source>
				<target>1.8</target>
				<encoding>UTF-8</encoding>
			</configuration>
		</plugin>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-surefire-plugin</artifactId>
			<version>2.19</version>
			<configuration>
				<suiteXmlFiles>
					<suiteXmlFile>testng.xml</suiteXmlFile>
				</suiteXmlFiles>
			</configuration>
		</plugin>

	</plugins>
</build>

#2

Can you give more details around “wait not working”?.. Is it simply not waiting and moving through the script too quickly or is your script stalled on a wait that never ends even though the element that you are passing in is valid and visible? Are you getting an exception from the try block that could help tell us what is going on? Do you get different results if you simply thread.sleep() for a while instead of doing a wait? Could you attach the Appium logs from your run?