Selenium: noshelementexception: невозможно найти элемент - метод: xpathJAVA

Программисты JAVA общаются здесь
Ответить Пред. темаСлед. тема
Anonymous
 Selenium: noshelementexception: невозможно найти элемент - метод: xpath

Сообщение Anonymous »

У меня есть проблемы с методом Findelement в селене.
сайт очень плохой, но не смотрите на него :)
my html: < /p>

Код: Выделить всё

   




Rezerwacja

/**/







//




/**/





 



Wybór lotu


Date: 

Destination: 






P³atno¶æ



Podaj dane osobowe: - Imiê

 - Nazwisko

Podaj nr telefonu: - Telefon

Wybierz p³eæ: - Kobieta

 -
Mê¿czyzna

Podaj datê urodzenia:dzieñ  / miesi±c / rok



1



2



3



4



5



6



7



8



9



10



11



12



12



13



14



15



16



17



18



19



20



21



22



23



24



25



26



27



28



29



30



31

 

1



2



3



4



5



6



7



8



9



10



11



12

  & l t ; s e l e c t   n a m e = " r o k . u r o d z i n " & g t ; < b r   / >                 & l t ; o p t i o n   s e l e c t e d = " s e l e c t e d " & g t ; < b r   / >                     1 8 9 9 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 0 0 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 0 1 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 0 2 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 0 3 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 0 4 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 0 5 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 0 6 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 0 7 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 0 8 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 0 9 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 1 0 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 1 1 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 1 2 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 1 3 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 1 4 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 1 5 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 1 6 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 1 7 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 1 8 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 1 9 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 2 0 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 2 1 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 2 2 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 2 3 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 2 4 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 2 5 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 2 6 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 2 7 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 2 8 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 2 9 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 3 0 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 3 1 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 3 2 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 3 3 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 3 4 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 3 5 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 3 6 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 3 7 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 3 8 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 3 9 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 4 0 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 4 1 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 4 2 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 4 3 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 4 4 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 4 5 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 4 6 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 4 7 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 4 8 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 4 9 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 5 0 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 5 1 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 5 2 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 5 3 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 5 4 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 5 5 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   / >                 & l t ; o p t i o n & g t ; < b r   / >                     1 9 5 6 < b r   / >                 & l t ; / o p t i o n & g t ; < b r   / > < b r   />        
1957



1958



1959



1960



1961



1962



1963



1964



1965



1966



1967



1968



1969



1970



1971



1972



1973



1974



1975



1976



1977



1978



1979



1980



1981



1982



1983



1984



1985



1986



1987



1988



1989



1990



1991



1992



1993



1994



1995



1996



1997



1998



1999



2000



2001



2002



2003



2004



2005



2006



2007



2008



2009



2010



2011



2012



2013



2014



2015



Podaj adres e-mail:Przyk³adowy adres:  example@xx.xx

 - E-mail




Wybierz miejsce:

[img]seats.png[/img]

Rz±d 

1



2



3



4



5



6



7



8



9



10



11



12



12



13



14



15



16



17



18



19



20



21



22



23



24



25



26



27



28



29



30

  Miejsce 

A



B



C



D



E



F





Twoje rezerwacje

XXXXXXXXXXXXXXX




Zap³aæ:




Zap³acone

na MAILA ZOSTA£Y WYS£ANE SZCZEGÓ£Y REZERWACJI


"ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all">

about:blank



< /code>

my java < /p>

   @Test
public void paypal() {
driver.findElement(By.xpath("//input[@value='Paypal']")).click();

System.out.println("Current page title is : " + driver.getTitle() + ", time: " + System.currentTimeMillis());

}
< /code>

И я получил ошибку: < /p>

 org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"xpath","selector":"//input[@value='Paypal']"}
Command duration or timeout: 5.10 seconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12'
System info: host: '471B07N', ip: '192.168.100.184', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_65'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{applicationCacheEnabled=true, rotatable=false, handlesAlerts=true, databaseEnabled=true, version=42.0, platform=WINDOWS, nativeEvents=false, acceptSslCerts=true, webStorageEnabled=true, locationContextEnabled=true, browserName=firefox, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 1f8f5d21-e52d-4b5b-b22e-31e615137579
*** Element info:  {Using=xpath, value=//input[@value='Paypal']}
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.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:647)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:353)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:490)
at org.openqa.selenium.By$ByXPath.findElement(By.java:361)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:345)
at com.selenium.tests.testSuite1.HomePage.paypal(HomePage.java:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:639)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:821)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1131)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:124)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at org.testng.TestRunner.privateRun(TestRunner.java:773)
at org.testng.TestRunner.run(TestRunner.java:623)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
at org.testng.SuiteRunner.run(SuiteRunner.java:259)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1185)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1110)
at org.testng.TestNG.run(TestNG.java:1018)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
Caused by: org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"xpath","selector":"//input[@value='Paypal']"}
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12'
System info: host: '471B07N', ip: '192.168.100.184', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_65'
Driver info: driver.version: unknown
at .FirefoxDriver.prototype.findElementInternal_(file:///C:/Users/wojkrz/AppData/Local/Temp/anonymous1649881075161346457webdriver-profile/extensions/fxdriver@googlecode.com/components/driver-component.js:10659)
at .fxdriver.Timer.prototype.setTimeout/

Подробнее здесь: [url]https://stackoverflow.com/questions/34336116/selenium-nosuchelementexception-unable-to-locate-element-methodxpath[/url]
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «JAVA»