如何在Selenium Java中为HtmlUnitDriver设置用户代理属性?我可以为firefox驱动程序设置它
FirefoxProfile ffp = new FirefoxProfile();
ffp.setPreference("general.useragent.override", "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; Media Center PC 6.0; InfoPath.3; MS-RTC LM 8; Zune 4.7");
WebDriver driver = new FirefoxDriver(ffp);
Run Code Online (Sandbox Code Playgroud)
有没有办法为HtmlUnitDriver做到这一点?我试过使用setCapability("UserAgentName","一些UA设置"); 但这不起作用.
我有这样的文件
EntityName Jaws
{
Animation WALK
{
NumberOfFrames 9
DirectionOfSprite L
DirectionGenerate LR
FPS 9
}
Animation IDLE
{
NumberOfFrames 6
DirectionOfSprite L
DirectionGenerate LR
FPS 9
}
.......
.......
}
Run Code Online (Sandbox Code Playgroud)
如何在此结构中解析此文件
struct AnimationData
{
string animationName;
int noOfFrames;
eAnimationDataDirection direction;
int FPS;
};
struct EntityAnimationData
{
string entityName;
vector<AnimationData> animationData;
string getSpriteResourceName(AnimationData animationData, int frameNumber);
};
Run Code Online (Sandbox Code Playgroud)
我想将这些数据存储到结构中.我该如何获得一个干净的解决方案?我已经阅读了文件的基本阅读材料.
这就是我尝试过的
EntityAnimationData parseAnimationData(const char* filename)
{
EntityAnimationData data;
ifstream file;
file.open(filename);
char output[128];
string op;
if (file.is_open())
{
while (!file.eof())
{
file …Run Code Online (Sandbox Code Playgroud)