Я новичок в selenium webdriver, и сегодня у меня есть некоторые проблемы с моим примером входа и выхода из системы. Я хочу получить элемент в gmail, но eclipse всегда замечает ошибку. Element i want to get (my email test)Построить Xpath, когда получить элемент в java
И вот мой xpath: //*[@id='gb']//descendant::div[@class='gb_vb']
. Но при поиске, eclipse всегда замечает ошибку.
Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to locate element: //*[@id='gb']//descendant::div[@class='gb_vb']
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:49:13 -0700'
System info: host: 'Alex', ip: '192.168.1.7', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_112'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{rotatable=false, raisesAccessibilityExceptions=false, marionette=true, firefoxOptions={args=[], prefs={}}, appBuildId=20160623154057, version=, platform=XP, proxy={}, command_id=1, specificationLevel=0, acceptSslCerts=false, browserVersion=47.0.1, platformVersion=10.0, XULappId={ec8030f7-c20a-464f-9b0e-13a3a9e97384}, browserName=Firefox, takesScreenshot=true, takesElementScreenshot=true, platformName=Windows_NT, device=desktop}]
Session ID: 2fd78092-bf4a-4095-8a32-1a2e1d22ed3e
*** Element info: {Using=xpath, value=//*[@id='gb']//descendant::div[@class='gb_vb']}
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:127)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:93)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:42)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:163)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:368)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:473)
at org.openqa.selenium.By$ByXPath.findElement(By.java:361)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:360)
at CucumberTest.LoginTestFunction.WaitandElement.findE(WaitandElement.java:19)
at CucumberTest.LoginTestFunction.SeleniumTest.main(SeleniumTest.java:30)
Добавить 'HTML' целевого элемента вместо его изображений – Andersson
@Andersson извините, но им не знают, как добавить рис в StackOverflow. им новичок здесь. Я пытаюсь использовать
, но просто покажу ссылку. –
Не добавляйте изображение, добавляйте 'HTML' в виде текста (скопируйте его с консоли разработчика) – Andersson