java - 在硒中寻找伪元素
问题描述
我试图找到这个元素(下面的屏幕截图)我正在使用 Java,我尝试使用 cssSelector 和 xpath 都没有工作。
Technology.click();
wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[@id=\"paletteItem:_8827283_1\"]/a/span")));
WebElement VS = driver.findElement(By.xpath("//*[@id=\"paletteItem:_8827283_1\"]/a/span"));
VS.click(); // all of the above works correctly, but after this point it keeps waiting and then erroring.
wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("#main-content > header > div > h1")));
System.out.println("Found");
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("document.querySelector(\"#session-0c5d29dffcf04299a02e217d457f7718 > div.item-list__item-details.click()");
HTML:
<div class="item-list__item-wrapper ng-isolate-scope" bb-session-list-item-content="session" tooltip-position="tooltipPosition" expand="sessionListItem.toggleExpand()" is-expanded="sessionListItem.isExpanded()" is-admin-view="isAdminView" can-edit="sessionListItem.canEdit()" can-show-options="sessionListItem.canShowOptions()" can-launch="sessionListItem.canLaunch()" can-launch-phone="sessionListItem.canLaunchPhone()" can-delete="sessionListItem.canDelete()" can-show-reports="sessionListItem.canShowReports()" can-copy-guest-link="sessionListItem.canCopyGuestLink()"><button class="item-list__item session-list-item-content item-list__item--active" id="session-a07f7478cf154c6ea4e9a56e5f1f1bca" aria-label="Show occurrences for session: الإسبوع الثالث_الطرقان" aria-describedby="session-a07f7478cf154c6ea4e9a56e5f1f1bca-details" ng-attr-aria-expanded="{{session.hasOccurrences ? (isExpanded ? 'true' : 'false') : undefined }}" ng-click="sessionListItemContent.sessionClicked()" ng-class="{'item-list__item--active': canLaunch}" aria-expanded="true">
解决方案
推荐阅读
- spring - 将 vaadin 流启动器应用程序部署到 WebSphere Liberty 时出错
- javascript - 为什么我无法使用以下代码将文件上传到 AWS S3?
- elixir - 不同元素更改时调用 LiveView update() 挂钩
- python - 当提到(未调用)内置退出函数时,为什么 PyInstaller 可执行文件会终止?
- android - 在android中显示自定义图像:XML config
- angular - “AngularFireAuth”类型上不存在属性“数据库”
- deep-learning - 使用预训练的 VGG-16 验证损失和准确性都在增加
- terraform - 获取动态块内集合的索引
- django - Django - 如何为整个 django 项目(全球)声明 IntegerChoice 和 IntegerField
- java - Android 来电显示设备