This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extract( | |
shortcode_atts( | |
array( | |
'id' => null, | |
), | |
$atts) | |
); | |
if ($id == null) { | |
return ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@media only screen and (max-device-width: 480px) { | |
div#wrapper { | |
width: 400px; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void starting(Description d) { | |
fName = d.getClassName() + "." + d.getMethodName(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class NameRuleTest { | |
@Rule public TestName name = new TestName(); | |
@Test public void testA() { | |
assertEquals("testA", name.getMethodName()); | |
} | |
@Test public void testB() { | |
assertEquals("testB", name.getMethodName()); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
boolean findElement(List<String> elements, String desiredElement) { | |
checkNotNull(elements); | |
// ... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
checkArgument(i < j, "Expected i < j, but %s > %s", i, j); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public String toString() { | |
return new StringBuilder() | |
.append("Name: " + name) | |
.append("Foo: " + foo) | |
.append("Bar: " + bar) | |
.toString(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function NewXmlHttpRequest() { | |
try { | |
return new window.XMLHttpRequest(); | |
} | |
catch(e) {} //standard API | |
try { | |
return new ActiveXObject("Msxml2.Xmlhttp.6.0"); | |
} | |
catch(e) {} | |
try { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public byte[] takeScreenshot() throws IOException { | |
TakesScreenshot takesScreenshot = (TakesScreenshot) driver; | |
return takesScreenshot.getScreenshotAs(OutputType.BYTES); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public BufferedImage createElementImage(WebElement webElement) | |
throws IOException { | |
// 获得webElement的位置和大小。 | |
Point location = webElement.getLocation(); | |
Dimension size = webElement.getSize(); | |
// 创建全屏截图。 | |
BufferedImage originalImage = | |
ImageIO.read(new ByteArrayInputStream(takeScreenshot())); | |
// 截取webElement所在位置的子图。 | |
BufferedImage croppedImage = originalImage.getSubimage( |
OlderNewer