通过CSS选择器选择特定值

时间:2016-02-12 00:39:40

标签: c# selenium xpath css-selectors

我有一个HTML

[2016-02-11 17:40:39,670] admin@test.com [1] [DAS] INFO {org.wso2.carbon.core.services.util.CarbonAuthenticationUtil} -  'admin@test.com [1]' logged in at [2016-02-11 17:40:39,670-0700]
[2016-02-11 17:40:39,674] admin@test.com [1] [DAS] INFO {org.wso2.carbon.event.receiver.core.internal.util.helper.EventReceiverConfigurationFileSystemInvoker} -  Event receiver configuration saved to the filesystem :httpReceiver.xml
[2016-02-11 17:40:39,675] admin@test.com [1] [DAS] INFO {org.wso2.carbon.event.input.adapter.core.internal.InputAdapterRuntime} -  Connecting receiver httpReceiver
[2016-02-11 17:40:39,676] admin@test.com [1] [DAS] INFO {org.wso2.carbon.event.stream.core.internal.EventJunction} -  Producer added to the junction. Stream:BAM_MESSAGE_TRACE:1.0.0
[2016-02-11 17:40:39,676] admin@test.com [1] [DAS] INFO {org.wso2.carbon.event.receiver.core.EventReceiverDeployer} -  Event Receiver configuration successfully deployed and in active state: httpReceiver

现在我想选择Day by CSSselector我该怎么做?

我可以通过

进行
 <span class="filter-option pull-left">Day</span>

但是如何指定要选择的日期?

1 个答案:

答案 0 :(得分:0)

我想你要做的就是在“Day”文本中应用一些样式。您可以通过在span元素中使用id或类来实现此目的。例如:

 <span id="my-id" class="filter-option pull-left">Day</span>

然后在你的样式文件中使用它:

#my-id{
    /* some styles */
}

如果您想要做的是获取跨度(“日”)的内容,则不可能只使用CSS,为此,您需要使用Javascript。这有助于:Get value of Span Text