ขณะนี้ฉันกำลังทดสอบเว็บแอปพลิเคชัน GWT ที่คล้ายกับ MS Paint และปัญหาที่ฉันกำลังเผชิญคือกรณีทดสอบของฉันส่งผ่านบนเบราว์เซอร์เช่น Chrome, Firefox และ IE แต่น่าเสียดายที่มันล้มเหลวในเบราว์เซอร์ Microsoft Edge ฉันไม่สามารถค้นหาวิธีแก้ปัญหานี้ได้หลังจากค้นหาในอินเทอร์เน็ตทั้งหมดและลองใช้วิธีการต่างๆ ที่เขียนไว้ใน Stack Overflow และ Google Groups ฉันรู้สึกสิ้นหวังอย่างยิ่ง ในขณะเดียวกันนี่คือรหัสของฉัน:
public class Insert_Element_in_Edge {
private static WebDriver driver;
@Test
public void main() throws InterruptedException, IOException
{
// TODO Auto-generated method stub
System.setProperty("webdriver.edge.driver", "D:\\SELENIUM\\Drivers\\MicrosoftWebDriver.exe");
driver = new EdgeDriver();
driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);
driver.manage().window().maximize();
Thread.sleep(3000);
driver.get("xxxx.com");
WebDriverWait wait = new WebDriverWait(driver, 20);
wait.until(ExpectedConditions.titleContains("xxxx"));
WebElement canvas = driver.findElement(By.id("frontCanvas"));
Thread.sleep(3000);
final String InsertPath="//img[contains(@src,'Insert Element')]";
WebElement Insert = driver.findElement(By.xpath(InsertPath));
Thread.sleep(3000);
Insert.click();
}
}
นี่คือข้อผิดพลาดที่ฉันกำลังเผชิญอยู่:
org.openqa.selenium.ElementNotVisibleException: องค์ประกอบไม่แสดง (คำเตือน: เซิร์ฟเวอร์ไม่ได้ให้ข้อมูล stacktrace ใด ๆ )
รับด้านล่างเป็นรหัส HTML ขององค์ประกอบที่ฉันพยายามค้นหาในเบราว์เซอร์ Edge
<div id="isc_2Q" eventproxy="isc_XXXIconButton_SClient_1" role="button" aria-label="xxx"
onfocus="isc.EH.handleFocus(isc_XXXIconButton_SClient_1,true);"
onblur="if(window.isc)isc.EH.handleBlur(isc_XXXIconButton_SClient_1,true);"
tabindex="1020" style="position: absolute; left: 0px; top: 54px; width: 40px;
height: 34px; z-index: 201152; padding: 0px; opacity: 1; overflow: visible;
cursor: pointer;" onscroll="return isc_XXXIconButton_SClient_1.$lh()" class="iconHoverZindex">
<div id="isc_2R"
eventproxy="isc_XXXIconButton_SClient_1" style="position: relative;
-webkit-margin-collapse: separate separate; visibility: inherit;
z-index: 201152; padding: 0px; cursor: pointer;">
<table role="presentation" cellspacing="0" cellpadding="0" width="40px" height="34px">
<tbody>
<tr>
<td nowrap="true" class="iconButton" style="background-color:transparent;"
align="center" valign="middle" onfocus="isc_XXXIconButton_SClient_1.$47()">
<img src="Insert Element.png" width="24" height="24" align="TEXTTOPundefined"
class="iconButtonHIcon" eventpart="icon" border="0"
suppress="TRUE" draggable="true"/>
<span style="vertical-align:middle;align-content:center;"></span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
องค์ประกอบนี้มองเห็นได้ในเบราว์เซอร์อีก 3 ตัวและคลิกได้สำเร็จ แต่ฉันเพิ่งติดอยู่ใน Edge นอกจากนี้ ใน Edge ผืนผ้าใบ HTML5 จะไม่แสดงโดยใช้ Selenium เช่นกัน กรุณาช่วย.
HTML
ที่คุณระบุ ฉันไม่สามารถระบุตำแหน่งองค์ประกอบใดองค์ประกอบหนึ่งได้ เช่นBy.id("frontCanvas")
และ//img[contains(@src,'Insert Element')]
ฉันพลาดอะไรไปรึเปล่า? - person DebanjanB   schedule 17.10.2017