import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class mTest {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
Map<String, String> map = new HashMap<>();
Map<String, String> map1 = new HashMap<>();
for (int i = 0; i < 20; i++) map.put("el" + (i + 1), "");
String cur_line;
boolean flag = false;
int k = 1, m = 1;
for (int i = 0; i < 310; i++) {
cur_line = in.nextLine();
if (cur_line.contains("\"method\":"))
{
String method = cur_line.substring(cur_line.indexOf(": \"") + 3, cur_line.lastIndexOf("\""));
map.put("el" + k, method);
continue;
}
if (cur_line.contains("\"arg\":")) {
String str = map.get(("el" + k));
String arg = cur_line.substring(cur_line.indexOf(": \"") + 3, cur_line.lastIndexOf("\""));
map.put("el" + k, str + "(" + arg);
k++;
}
// 这里读使用click、sendKeys
if(cur_line.contains("gradepoints")) flag = true;
if (cur_line.contains("click") && flag) map1.put("el" + m++, ".click()");
else if (cur_line.contains("sendKeys") && flag) map1.put("el" + m++, ".sendKeys()");
}
for (int i = 1; i < 21; i++)
{
String sta = map.get("el" + i);
String method = sta.substring(0, sta.indexOf("("));
String arg = sta.substring(sta.indexOf("(") + 1);
String op = map1.get("el" + i);
if (method.equals("name"))
{
System.out.println(name(arg, op));
}
else if (method.equals("class"))
{
System.out.println(clazz(arg, op));
}
else if(method.equals("linkText"))
{
System.out.println(linkText(arg, op));
}
else if (method.equals("id"))
{
System.out.println(id(arg, op));
}
else if (method.equals("xpath"))
{
System.out.println(xpath(arg, op));
}
else if (method.equals("cssSelector"))
{
System.out.println(cssSelector(arg, op));
}
System.out.println("sleep(1500);");
}
}
public static String name (String name, String op) {
return "driver.findElement(By.name("+name+"))"+ op +";";
}
public static String clazz (String className, String op) {
return "driver.findElement(By.className("+className+"))"+ op +";";
}
public static String xpath(String xpath, String op) {
return "driver.findElement(By.xpath("+xpath+"))"+op+";";
}
public static String linkText (String linkText, String op) {
return "driver.findElement(By.linkText("+linkText+"))"+op+";";
}
public static String id (String id, String op) {
return "driver.findElement(By.id("+id+"))"+op+";";
}
public static String cssSelector (String css, String op) {
return "driver.findElement(By.cssSelector("+css+"))"+op+";";
}
}