SyntaxError:意外的标识符Node.js Selenium

时间:2017-01-26 16:49:01

标签: node.js selenium

所以我有这个小脚本:

public class stud {
    int id;
    String nam;
    String courses[];
    double grades[];
    int maxSize, size;

    public stud(int d, String n, int ms)
    {
        // initialise the attributes
        id = d;
        nam = n;

        // create empty arrays with a size of ms
        courses = new String[ms];
        grades = new double[ms];

        //point to the first item in the array
        //Also gives the number of values in the array
        size=0;
     }

     public void addCourse(String nc, double g)
     {
         //Add a course name and grade into the array
         //they are added at the location pointed to by 'size'
         courses[size]=nc;
         grades[size]=g;

         //Increment the pointer to the next empty array location
         size++;
     }

     public void print()
     {
         System.out.println(id+ " "+nam);

        //Iterate over the arrays until we get to the size
        for(int i=0; i<size; i++)
            System.out.println(courses[i]+ " "+grades[i]);
     }
}

它应该打开firefox转到youtube并滚动到屏幕底部加载更多按钮。但它会引发语法错误。

1 个答案:

答案 0 :(得分:1)

您应该尝试更改此行

WebElement element = driver.findElement(By.class("load-more=text']"));

作为

WebElement element = driver.findElement(By.className("load-more-text"));

因为类名load-more=text']更可能是load-more-text而AFAIK没有By.class,但是By.className