-
Notifications
You must be signed in to change notification settings - Fork 152
fix for rare failure on some motorola devices #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,17 +5,27 @@ | |
|
||
import org.testng.Assert; | ||
import org.testng.annotations.Test; | ||
import org.openqa.selenium.JavascriptExecutor; | ||
|
||
public class SingleTest extends BrowserStackTestNGTest { | ||
|
||
@Test | ||
public void test() throws Exception { | ||
driver.get("https://www.google.com/ncr"); | ||
try { | ||
WebElement ele = driver.findElement(By.className("IKl7Q")); | ||
if(ele.isDisplayed()) { | ||
((JavascriptExecutor)driver).executeScript("arguments[0].scrollTo(0, arguments[0].scrollHeight)",ele); | ||
driver.findElement(By.xpath("//*[@id='L2AGLb']/div")).click(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these classnames and ids might change in the future with their deploys since they are generated for creating unique values from original classnames (to prevent collision) Will require some other selectors. |
||
} | ||
} | ||
catch(Exception e){ | ||
System.out.print(e); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will this print the actual message or just tell the object type is of exception class? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It will print this kind of message |
||
} | ||
WebElement element = driver.findElement(By.name("q")); | ||
element.sendKeys("BrowserStack"); | ||
element.submit(); | ||
Thread.sleep(5000); | ||
|
||
Assert.assertEquals("BrowserStack - Google Search", driver.getTitle()); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't these ids are generated by the framework at runtime and can change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I have updated the code to find the element.