2016-07-06 74 views
0

我想click一個div標題,但有一些困難,CSS,下面是CSS如何點擊硒

html body#RuntimeFormBody form#Form1 div#tblContainer div#Content div#ContainerCell div#ContainerSizeGuide div.WebControl.ctTabbedFolder.ControlViewportDESKTOP div#TabbedFolder1 div.contentholder span#TabbedFolder1Page1.TabHL.TabSelected div a 

代碼只是爲了click上面,所以我不認爲我需要提供,因爲它不會真的幫助。

我有類似的東西,這是

html body.CommunityBody form#Form1 div.MainCommunityTable.MobileLayoutBlock div div div.NarrowCommunity span.AddinSpan div.AddIn.atScreens.AddInViewportDESKTOP.AddInDisplayBLOCK div#AddInMyQuickLinks.AddInCollapsible.ui-accordion.ui-widget.ui-helper-reset div#ui-accordion-AddInMyQuickLinks-panel-0.AddInMain.ui-accordion-content.ui-helper-reset.ui-widget-content.ui-corner-bottom.ui-accordion-content-active span ul.NoIndent li.NoBullet.jms-bullet h3 a img 

,將溶液下方的幫助。

@FindBy(css = "li:nth-child(1).NoBullet.jms-bullet> h3>a[href^='javascript:ShowSelectedAddInScreen']") 

所以我正在尋找一個類似的解決方案。

在此先感謝您的幫助! :)

添加HTML

<img width="15" border="0" align="ABSMIDDLE" alt="Click to edit Payroll Company" onkeydown="xCode=String.fromCharCode(event.keyCode).charCodeAt(0);if (xCode == 32){$(this).click()};" onclick="$HRnet('PAYROLLCOMPANY1').lookupID='db775dbd-f0c4-4c15-9280-d8e881a728c0';$HRnet('PAYROLLCOMPANY1').screenID='00000000-0000-0000-0000-000000000000';$HRnet('PAYROLLCOMPANY1').caption='Select Lookup Value - Payroll Company';$HRnet('PAYROLLCOMPANY1').filterControl=0;$HRnet('PAYROLLCOMPANY1').filterFieldType='0';$HRnet('PAYROLLCOMPANY1').filterFieldCaption='';$HRnet('PAYROLLCOMPANY1').filterValueDataView='00000000-0000-0000-0000-000000000000';$HRnet('PAYROLLCOMPANY1').filterValueTable='';$HRnet('PAYROLLCOMPANY1').filterValueField='';$HRnet('PAYROLLCOMPANY1').filterFieldOnScreen='False';$HRnet('PAYROLLCOMPANY1').isChangesMade='TRUE';$HRnet('PAYROLLCOMPANY1').currentRecordID='00000000-0000-0000-0000-000000000000';if ($HRnet('PAYROLLCOMPANY1').filterBySystemFieldValue==undefined) $HRnet('PAYROLLCOMPANY1').filterBySystemFieldValue='';$HRnet('PAYROLLCOMPANY1').impersonationId='';$HRnet('PAYROLLCOMPANY1').impersonationToken='';$HRnet('PAYROLLCOMPANY1').show();" style="POSITION:RELATIVE;TOP:0px;LEFT:2px;cursor:pointer;" tabindex="1" title="Click to edit Payroll Company" src="/V14_ST1/Application/Images/btnLookup.png"> 

回答

1

這應該只是

By.cssSelector("#TabbedFolder1Page1 div a") 

我不習慣閱讀CSS像你這貼。我不知道從哪裏來。 HTML會更有用(至少對我而言)。您可以使用下面的內容來更具體。

By.cssSelector("#TabbedFolder1Page1 > div > a") 
+0

您好我已經添加了html,但我會嘗試上面的建議。 – OhAye

+0

感謝您的幫助,工作。 – OhAye