私はSelenium-Webdriverを練習していて、望ましい要素(テキスト)がWebページに表示されていますが、クリックできません。表示されているテキストをクリックできませんが、isDisplayed = False
この要素をチェックしようとすると、コマンドライン "isDisplayed"で表示されるかどうかがチェックされ、コンソールはfalseの結果を返します。私は、ウェブ上のテキスト(添付ファイルのハイライトを参照してください)が見えるが、なぜクリックできないのか、ちょっと混乱していますか?
この場合、どのようにしてアクションを実行できますか?あなたのアイデアや戦略を分かち合うことができますか?
ありがとうございました。ここで
は、Webページは次のとおりです。 http://www.lazada.com.ph/
私のコードは
System.setProperty("webdriver.chrome.driver", driver_path);
WebDriver driver = new ChromeDriver();
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.get("https://www.lazada.com.ph/");
//Click on Men's Fashion
WebElement loc = driver.findElement(By.xpath("//div[@data-qa-locator='brands-by-category-cats-item']/div[@data-tab-id='2']"));
Actions hover = new Actions(driver);
hover.moveToElement(loc).click().build().perform();
エラー・ログです:
false
Exception in thread "main" org.openqa.selenium.interactions.MoveTargetOutOfBoundsException: (-2114, -93.0999984741211) is out of bounds of viewport width (1366) and height (659)
Build info: version: '3.6.0', revision: '6fbf3ec767', time: '2017-09-27T16:15:26.402Z'
System info: host: 'Lorem', ip: '192.168.30.1', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_65'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{moz:profile=C:\Users\Lorem\AppData\Local\Temp\rust_mozprofile.y3xzzu5rD0i5, rotatable=false, timeouts={implicit=0, pageLoad=300000, script=30000}, pageLoadStrategy=normal, moz:headless=false, platform=XP, specificationLevel=0, moz:accessibilityChecks=false, acceptInsecureCerts=true, browserVersion=56.0.2, platformVersion=6.3, moz:processID=4724, browserName=firefox, javascriptEnabled=true, platformName=XP}]
Session ID: 893e64ce-b53c-4bec-9f98-14832e4b7151
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:185)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:120)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:164)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:586)
at org.openqa.selenium.remote.RemoteWebDriver.perform(RemoteWebDriver.java:652)
at org.openqa.selenium.interactions.Actions$BuiltAction.perform(Actions.java:638)
at basic.Wait.main(Wait.java:41)
ChromeとFireforの両方で動作しますThanks to @DebanjanB、それは画面サイズに関連するビューポートです。 、モバイルビュー、タブレットビューなどがありますが、DEデスクトップビューの要素の表示にも関係していますので、いくつかの記事や知識を表示できますか? さらにjavascriptexecutorを使用すると助けになりますテスターの観点からは、使用する際には何か推奨事項がありますか? ありがとう。 – LearningandWorking
This [** 'Discussion/QA' **](https://stackoverflow.com/questions/44912203/selenium-web-ドライバ - java-element-not-click-at-point-36-72-other-el/44916498#44916498)は、多くの質問をクリアします。 'Upv ote' **あなたの役に立つことがあればどんな答えでも。 – DebanjanB