【发布时间】:2020-01-25 07:06:09
【问题描述】:
我怎样才能为这个elemant 创建一个动态XPath,这里没有class 或id,只是内联CSS。我也需要像这样增加 div 号
<div role="none" style="position: relative; display: flex; flex-direction: row; flex-grow: 1; flex-shrink: 1; overflow: hidden; align-items: center; border-radius: 0px; cursor: pointer; padding: 4px 10px; background-color: rgba(0, 0, 0, 0); min-height: 55px;"><div role="none" style="position: relative; display: flex; flex-direction: row; flex-grow: 1; flex-shrink: 1; overflow: hidden; align-items: center; background-color: rgba(0, 0, 0, 0);"><div role="none" aria-hidden="true" style="position: relative; display: flex; flex-direction: column; flex-grow: 0; flex-shrink: 0; overflow: visible; align-items: stretch; width: 40px; height: 40px; justify-content: center;"><div role="none" style="position: absolute; display: flex; flex-direction: column; flex-grow: 0; flex-shrink: 0; overflow: hidden; align-items: center; left: 0px; right: 0px; top: 0px; bottom: 0px; justify-content: center;"><div role="none" style="position: relative; display: flex; flex-direction: row; flex-grow: 0; flex-shrink: 0; overflow: hidden; align-items: center; background-color: rgb(229, 228, 232); width: 40px; height: 40px; border-radius: 20px; justify-content: center;"
/html/body/div[1]/div/div[1]/div[2]/div/div[1]/div/div[1]/div[4]/div[2]/div/div[2]/div/div/div[1]/div/div/div[1]/div[2]/div/div
/html/body/div[1]/div/div[1]/div[2]/div/div[1]/div/div[1]/div[4]/div[2]/div/div[2]/div/div/div[1]/div/div/div[1]/div[3]/div/div
【问题讨论】:
标签: c# selenium selenium-webdriver automation automated-tests