Skip to content
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

Utils.snapshot not getting correct image if page moves using Utils.highlight or Utils.scrollIntoView #5

Open
panama69 opened this issue Aug 17, 2018 · 0 comments

Comments

@panama69
Copy link

panama69 commented Aug 17, 2018

The below code sample where I opened a chrome browser on CentOS machine and set the window to a specific size to replicate the issues I have reported along with this one.

Notice that I am even re-finding the element after the Utils.hilight in case coordinate weren't correct after things scrolled a bit.

The snapshot should be capturing the price $1,009.00 from http://www.advantageonlineshopping.com/#/category/Tablets/3

System.setProperty("webdriver.chrome.driver", "./2.36/chromedriver");
ChromeOptions co = new ChromeOptions();
co.addExtensions(new File("/opt/leanft/Installations/Chrome/Agent.crx")); // path to agent on my linux yours may differ
co.addArguments("disable-infobars");
WebDriver driver = new ChromeDriver(co);
driver.manage().window().setSize(new Dimension(945, 850));

...

we = driver.findElement(new ByEach(
        By.tagName("a"),
        By.visibleText(Pattern.compile("\\$1,00\\d\\.\\d\\d"))
        ));

Utils.highlight(we, 2000);

we = driver.findElement(new ByEach(
        By.tagName("a"),
        By.visibleText(Pattern.compile("\\$1,00\\d\\.\\d\\d"))
        ));

snapshot = Utils.getSnapshot(we);

Verify.areEqual ("$1,009.00", we.getText(), "Price Verification","Verify price displayed matches price expected", snapshot);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant