Java tutorial
/* * Copyright (C) 2015-2016 NS Solutions Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.htmlhifive.pitalium.it.screenshot.partialapge; import static org.hamcrest.CoreMatchers.*; import static org.hamcrest.MatcherAssert.*; import java.util.ArrayList; import java.util.List; import com.htmlhifive.pitalium.core.config.PtlTestConfig; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import com.htmlhifive.pitalium.core.PtlTestBase; import com.htmlhifive.pitalium.core.model.CompareTarget; import com.htmlhifive.pitalium.core.model.ScreenArea; import com.htmlhifive.pitalium.core.model.SelectorType; /** * ?visibility: hidden????<br> */ public class TakeHiddenPartTest extends PtlTestBase { private static final String BASE_URL = PtlTestConfig.getInstance().getTestAppConfig().getBaseUrl(); /** * ?visibility: hidden??????????????<br> * IE711/FireFox/Chrome/Android 2.3, 4.0, 4.4/iOS 8.1<br> * ????????????()??????????<br> * ???????????????? */ @Test public void takeHiddenPart() { driver.get(BASE_URL); List<CompareTarget> targets = new ArrayList<CompareTarget>(); targets.add(new CompareTarget(ScreenArea.of(SelectorType.CSS_SELECTOR, "#about"))); // ????? driver.executeJavaScript("document.getElementById('about').style.visibility = 'hidden';"); assertionView.assertView("takeHiddenPart", targets); // ??????? WebElement about = driver.findElement(By.id("about")); assertThat(about.getCssValue("visibility"), is("hidden")); } }