我有以下代码在弹出窗口中添加照片,然后在从弹出窗口返回后单击主窗口的 PUBLISH 按钮:
//我现在在主窗口中:
String myWindowHandle = driver.getWindowHandle();
driver.findElement(By.linkText("Add Photo")).click();//Add Photo link
driver.switchTo().window("uploadPhoto");
我已经过渡到弹出窗口:
elemById("widget_129_upload_file").sendKeys("F:\\Blossom.jpg");//Browsing a .jpg file
driver.findElement(By.cssSelector("input.button.submit")).click();//this is UPLOAD button at pop up window
driver.switchTo().defaultContent();
driver.switchTo().window(myWindowHandle);
我再次回到主窗口:
elemByCssSelector("input[value=Publish]").click();//Publish button at main window WHICH IS NOT BEING CLICKED
不幸的是,主窗口的发布按钮不起作用。没有错误,硒测试停止。我的代码有什么问题?有谁能够帮我?